Skip to content

Commit

Permalink
fix: resource naming update and azurerm major version update (#22)
Browse files Browse the repository at this point in the history
* feat: resource naming update and azure rm major version update

* fix minor changes

* fix fmt error

* Update CODEOWNERS

---------

Co-authored-by: Archit Chopra <87892837+13archit@users.noreply.github.com>
  • Loading branch information
d4kverma and 13archit authored Oct 18, 2024
1 parent 1bea796 commit 43edd80
Show file tree
Hide file tree
Showing 17 changed files with 99 additions and 62 deletions.
4 changes: 4 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version = 1

[[analyzers]]
name = "terraform"
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# These owners will be the default owners for everything in the repo.
* @anmolnagpal @clouddrove-ci
* @anmolnagpal @clouddrove/terraform-azure-admins @clouddrove-ci
32 changes: 31 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,42 @@

version: 2
updates:

- package-ecosystem: "terraform" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
# Add assignees
assignees:
- "clouddrove-ci"
# Add reviewer
reviewers:
- "approvers"
# Allow up to 3 open pull requests for pip dependencies
open-pull-requests-limit: 3

- package-ecosystem: "terraform" # See documentation for possible values
directory: "examples" # Location of package manifests
directory: "/examples/basic" # Location of package manifests
schedule:
interval: "weekly"
# Add assignees
assignees:
- "clouddrove-ci"
# Add reviewer
reviewers:
- "approvers"
# Allow up to 3 open pull requests for pip dependencies
open-pull-requests-limit: 3

- package-ecosystem: "terraform" # See documentation for possible values
directory: "/examples/complete" # Location of package manifests
schedule:
interval: "weekly"
# Add assignees
assignees:
- "clouddrove-ci"
# Add reviewer
reviewers:
- "approvers"
# Allow up to 3 open pull requests for pip dependencies
open-pull-requests-limit: 3
2 changes: 1 addition & 1 deletion .github/workflows/auto_assignee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
secrets:
GITHUB: ${{ secrets.GITHUB }}
with:
assignees: 'clouddrove-ci'
assignees: 'clouddrove-ci'
22 changes: 11 additions & 11 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

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'
---
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'
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
uses: clouddrove/github-shared-workflows/.github/workflows/changelog.yml@master
secrets: inherit
with:
branch: 'master'
branch: 'master'
10 changes: 7 additions & 3 deletions .github/workflows/tf-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ on:
pull_request:
workflow_dispatch:
jobs:
complete-example:
basic-example:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master
secrets: inherit
with:
working_directory: './examples/'
working_directory: './examples/basic/'

complete-example:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master
with:
working_directory: './examples/complete/'
2 changes: 1 addition & 1 deletion .github/workflows/tflint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ jobs:
tf-lint:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-lint.yml@master
secrets:
GITHUB: ${{ secrets.GITHUB }}
GITHUB: ${{ secrets.GITHUB }}
2 changes: 1 addition & 1 deletion .github/workflows/tfsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ jobs:
uses: clouddrove/github-shared-workflows/.github/workflows/tfsec.yml@master
secrets: inherit
with:
working_directory: '.'
working_directory: '.'
33 changes: 0 additions & 33 deletions _test/log_analytics_test.go

This file was deleted.

15 changes: 15 additions & 0 deletions examples/basic/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
provider "azurerm" {
features {}
subscription_id = "01110-12010122022111111c"
}

module "log-analytics" {
source = "./../../"
name = "app"
environment = "test"
resource_group_name = "test"
log_analytics_workspace_location = "test"

#### diagnostic setting
log_analytics_workspace_id = "333-2343-343"
}
2 changes: 1 addition & 1 deletion examples/verstion.tf → examples/basic/version.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "4.3.0"
version = ">=3.85.0"
}
}
}
4 changes: 2 additions & 2 deletions examples/example.tf → examples/complete/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
provider "azurerm" {
features {}
subscription_id = "<subscription-id>"
subscription_id = "000001-11111-1223-XXX-XXXXXXXXXXXX"
}

module "resource_group" {
Expand All @@ -14,7 +14,7 @@ module "resource_group" {
}

module "log-analytics" {
source = "./../"
source = "./../../"
name = "app"
environment = "test"
resource_group_name = module.resource_group.resource_group_name
Expand Down
12 changes: 12 additions & 0 deletions examples/complete/version.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
terraform {
required_version = ">= 1.0.0"
}

terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=3.85.0"
}
}
}
3 changes: 0 additions & 3 deletions examples/outputs.tf

This file was deleted.

4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module "labels" {

resource "azurerm_log_analytics_workspace" "main" {
count = var.enabled && var.create_log_analytics_workspace == true ? 1 : 0
name = format("%s-logs", module.labels.id)
name = format("%s-law", module.labels.id)
location = var.log_analytics_workspace_location
resource_group_name = var.resource_group_name
sku = var.log_analytics_workspace_sku
Expand All @@ -24,7 +24,7 @@ resource "azurerm_log_analytics_workspace" "main" {
}
resource "azurerm_monitor_diagnostic_setting" "example" {
count = var.enabled && var.diagnostic_setting_enable ? 1 : 0
name = format("%s-log-analytics-diagnostic-log", module.labels.id)
name = format("%s-law-diag", module.labels.id)
target_resource_id = join("", azurerm_log_analytics_workspace.main[*].id)
storage_account_id = var.storage_account_id
eventhub_name = var.eventhub_name
Expand Down
10 changes: 9 additions & 1 deletion variable.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ variable "log_analytics_workspace_sku" {
description = "pecifies the Sku of the Log Analytics Workspace. Possible values are Free, PerNode, Premium, Standard, Standalone, Unlimited, CapacityReservation, and PerGB2018 (new Sku as of 2018-04-03). Defaults to PerGB2018"

}

variable "create_log_analytics_workspace" {
type = bool
default = true
Expand All @@ -67,6 +68,7 @@ variable "retention_in_days" {
default = null
description = "The workspace data retention in days. Possible values are either 7 (Free Tier only) or range between 30 and 730."
}

variable "daily_quota_gb" {
type = string
default = "-1"
Expand All @@ -78,11 +80,13 @@ variable "internet_ingestion_enabled" {
default = true
description = "Should the Log Analytics Workspace support ingestion over the Public Internet? Defaults to true."
}

variable "internet_query_enabled" {
type = bool
default = true
description = "Should the Log Analytics Workspace support querying over the Public Internet? Defaults to true."
}

#### enable diagnostic setting
variable "log_analytics_destination_type" {
type = string
Expand All @@ -95,10 +99,12 @@ variable "Metric_enable" {
default = true
description = "Is this Diagnostic Metric enabled? Defaults to true."
}

variable "diagnostic_setting_enable" {
type = bool
default = true
default = false
}

variable "log_analytics_workspace_id" {
type = string
default = null
Expand All @@ -115,11 +121,13 @@ variable "storage_account_id" {
default = null
description = "The ID of the Storage Account where logs should be sent."
}

variable "eventhub_name" {
type = string
default = null
description = "Specifies the name of the Event Hub where Diagnostics Data should be sent."
}

variable "eventhub_authorization_rule_id" {
type = string
default = null
Expand Down

0 comments on commit 43edd80

Please sign in to comment.