Skip to content

Fixed Module Code and Removed Depriciated Values #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
.github/* @clouddrove/approvers

* @clouddrove/clouddrovians @clouddrove/approvers

.github/mergify.yml @clouddrove/admins
.github/CODEOWNERS @clouddrove/admins
# These owners will be the default owners for everything in the repo.
* @anmolnagpal @clouddrove-ci @clouddrove/terraform-azure-admins
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ updates:
schedule:
interval: "weekly"
- package-ecosystem: "terraform" # See documentation for possible values
directory: "_example" # Location of package manifests
directory: "examples" # Location of package manifests
schedule:
interval: "weekly"

14 changes: 14 additions & 0 deletions .github/workflows/auto_assignee.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Auto Assign PRs

on:
pull_request:
types: [opened, reopened]

workflow_dispatch:
jobs:
assignee:
uses: clouddrove/github-shared-workflows/.github/workflows/auto_assignee.yml@master
secrets:
GITHUB: ${{ secrets.GITHUB }}
with:
assignees: 'clouddrove-ci'
12 changes: 12 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Auto merge
on:
pull_request:
jobs:
auto-merge:
uses: clouddrove/github-shared-workflows/.github/workflows/auto_merge.yml@master
secrets:
GITHUB: ${{ secrets.GITHUB }}
with:
tfcheck: 'complete-example / Check code format'
...
59 changes: 10 additions & 49 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,15 @@
name: 'Create README.md file'
name: Readme Workflow
on:
push:
branches:
- master

paths-ignore:
- 'README.md'
- 'docs/**'
workflow_dispatch:
jobs:
readme-create:
name: 'readme-create'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@master

- name: 'Set up Python 3.7'
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: 'create readme'
uses: 'clouddrove/[email protected]'
with:
actions_subcommand: 'readme'
github_token: '${{ secrets.GITHUB }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


- name: 'pre-commit check errors'
uses: pre-commit/[email protected]
continue-on-error: true

- name: 'pre-commit fix erros'
uses: pre-commit/[email protected]
continue-on-error: true

- name: 'push readme'
uses: 'clouddrove/[email protected]'
continue-on-error: true
with:
actions_subcommand: 'push'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: 'Slack Notification'
uses: clouddrove/action-slack@v2
with:
status: ${{ job.status }}
fields: repo,author
author_name: 'CloudDrove'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
if: always()
README:
uses: clouddrove/github-shared-workflows/.github/workflows/readme.yml@master
secrets:
TOKEN : ${{ secrets.GITHUB }}
SLACK_WEBHOOK_TERRAFORM: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }}
30 changes: 0 additions & 30 deletions .github/workflows/semantic-releaser.yml

This file was deleted.

74 changes: 0 additions & 74 deletions .github/workflows/static-checks.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/workflows/tf-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: tf-checks
on:
push:
branches: [ master ]
pull_request:
workflow_dispatch:
jobs:
complete-example:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master
secrets: inherit
with:
working_directory: './examples/'
11 changes: 11 additions & 0 deletions .github/workflows/tflint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: tf-lint
on:
push:
branches: [ master ]
pull_request:
workflow_dispatch:
jobs:
tf-lint:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-lint.yml@master
secrets:
GITHUB: ${{ secrets.GITHUB }}
6 changes: 4 additions & 2 deletions _example/example.tf → examples/example.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
provider "azurerm" {
features {}
subscription_id = "000000-11111-1223-XXX-XXXXXXXXXXXX"
}

module "resource_group" {
Expand All @@ -14,18 +15,19 @@ module "resource_group" {

module "log-analytics" {
source = "clouddrove/log-analytics/azure"
version = "1.0.1"
version = "1.1.0"
name = "app"
environment = "test"
label_order = ["name", "environment"]
create_log_analytics_workspace = true
log_analytics_workspace_sku = "PerGB2018"
log_analytics_workspace_id = module.log-analytics.workspace_id
resource_group_name = module.resource_group.resource_group_name
log_analytics_workspace_location = module.resource_group.resource_group_location
}

module "application-insights" {
source = "clouddrove/application-insights/azure"
source = "./.."
name = "app"
environment = "test"
resource_group_name = module.resource_group.resource_group_name
Expand Down
File renamed without changes.
15 changes: 15 additions & 0 deletions examples/version.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
terraform {
required_version = ">= 1.3.0"

required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.112.0"
}

random = {
source = "hashicorp/random"
version = ">= 3.6"
}
}
}
28 changes: 11 additions & 17 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,12 @@ resource "azurerm_application_insights" "application_insights" {
tags = module.labels.tags
}


resource "azurerm_application_insights_web_test" "main" {
count = var.enabled && var.web_test_enable ? length(var.list_of_test_urls) : 0
name = element(var.web_test_name, count.index)
location = join("", azurerm_application_insights.application_insights.*.location)
location = azurerm_application_insights.application_insights[0].location
resource_group_name = var.resource_group_name
application_insights_id = join("", azurerm_application_insights.application_insights.*.id)
application_insights_id = azurerm_application_insights.application_insights[0].id
kind = var.kind
frequency = var.frequency
timeout = var.timeout
Expand All @@ -61,43 +60,38 @@ resource "azurerm_application_insights_web_test" "main" {

configuration = format("%s%s%s",
local.test_header,
join("", formatlist(local.replace_body, random_uuid.test_guids.*.result[count.index], random_uuid.test_guids.*.keepers.url[count.index])),
local.footer)
join("", formatlist(local.replace_body, random_uuid.test_guids[*].result, random_uuid.test_guids[*].keepers.url)),
local.footer
)


lifecycle {
ignore_changes = [
tags,
]
}

}

resource "azurerm_monitor_diagnostic_setting" "main" {
count = var.enabled && var.diagnostic_setting_enable ? 1 : 0
name = format("%s-application-insights-diagnostic-log", module.labels.id)
target_resource_id = join("", azurerm_application_insights.application_insights.*.id)
target_resource_id = azurerm_application_insights.application_insights[0].id
storage_account_id = var.storage_account_id
eventhub_name = var.eventhub_name
eventhub_authorization_rule_id = var.eventhub_authorization_rule_id
log_analytics_workspace_id = var.log_analytics_workspace_id
log_analytics_destination_type = var.log_analytics_destination_type

metric {
category = "AllMetrics"
enabled = var.Metric_enable
retention_policy {
enabled = var.retention_policy_enabled
days = var.diagnostic_log_days
}
}
log {

enabled_log {
category = var.category
category_group = "AllLogs"
retention_policy {
enabled = var.retention_policy_enabled
days = var.diagnostic_log_days
}
enabled = var.log_enabled
}

lifecycle {
ignore_changes = [log_analytics_destination_type]
}
Expand Down
12 changes: 7 additions & 5 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
output "app_insights_id" {
value = join("", azurerm_application_insights.application_insights.*.id)
value = join("", azurerm_application_insights.application_insights[*].id)
description = "The ID of the Application Insights component."
}

output "app_insights_app_id" {
value = join("", azurerm_application_insights.application_insights.*.app_id)
value = join("", azurerm_application_insights.application_insights[*].app_id)
description = "The App ID associated with this Application Insights component."
}

output "instrumentation_key" {
value = join("", azurerm_application_insights.application_insights.*.instrumentation_key)
value = join("", azurerm_application_insights.application_insights[*].instrumentation_key)
description = "The Instrumentation Key for this Application Insights component. (Sensitive)"
sensitive = true
}

output "connection_string" {
value = join("", azurerm_application_insights.application_insights.*.connection_string)
value = join("", azurerm_application_insights.application_insights[*].connection_string)
description = "The Connection String for this Application Insights component. (Sensitive)"
}
sensitive = true
}
File renamed without changes.
Loading