Skip to content
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

Added Latest Version and Removed Depreciated Variables #10

Merged
merged 8 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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: 'basic / 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.

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

This file was deleted.

11 changes: 11 additions & 0 deletions .github/workflows/tf-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: tf-checks
on:
push:
branches: [ master ]
pull_request:
workflow_dispatch:
jobs:
tf-checks-aws-managed-example:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master
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 }}
1 change: 1 addition & 0 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 = "<subscription-id>"
}

module "resource_group" {
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions examples/verstion.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.39.0"
}
}
}
21 changes: 4 additions & 17 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,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)
target_resource_id = join("", azurerm_log_analytics_workspace.main.*.id)
target_resource_id = join("", azurerm_log_analytics_workspace.main[*].id)
storage_account_id = var.storage_account_id
eventhub_name = var.eventhub_name
eventhub_authorization_rule_id = var.eventhub_authorization_rule_id
Expand All @@ -34,29 +34,16 @@ resource "azurerm_monitor_diagnostic_setting" "example" {
metric {
category = "AllMetrics"
enabled = var.Metric_enable
retention_policy {
enabled = var.retention_policy_enabled
days = var.days
}

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

log {
enabled_log {
category = var.category
category_group = "Audit"
retention_policy {
enabled = var.retention_policy_enabled
days = var.days
}
enabled = var.log_enabled
}
lifecycle {
ignore_changes = [log_analytics_destination_type]
Expand Down
4 changes: 2 additions & 2 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

output "workspace_id" {
value = var.create_log_analytics_workspace == true ? join("", azurerm_log_analytics_workspace.main.*.id) : null
value = var.create_log_analytics_workspace == true ? join("", azurerm_log_analytics_workspace.main[*].id) : null
}

output "workspace_customer_id" {
value = var.create_log_analytics_workspace == true ? join("", azurerm_log_analytics_workspace.main.*.workspace_id) : null
value = var.create_log_analytics_workspace == true ? join("", azurerm_log_analytics_workspace.main[*].workspace_id) : null
}
42 changes: 2 additions & 40 deletions variable.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@ variable "enabled" {
}


variable "tags" {
type = map(string)
default = {}
description = "A map of tags to add to all resources"
}
variable "log_analytics_workspace_name" {
type = string
default = "loganalytics"
description = "Name of the Log Analytics Workspace"
}

variable "log_analytics_workspace_location" {
type = string
default = "West Us"
Expand All @@ -67,20 +56,6 @@ 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 "email_receiver" {
type = list(any)
default = []
description = "One or more email_receiver blocks as defined below."
}

variable "scheduled_query_rules_alert" {
type = any
default = {}
description = "Manages an AlertingAction Scheduled Query Rules resource within Azure Monitor."
}

variable "create_log_analytics_workspace" {
type = bool
default = true
Expand Down Expand Up @@ -114,16 +89,7 @@ variable "log_analytics_destination_type" {
default = "AzureDiagnostics"
description = "Possible values are AzureDiagnostics and Dedicated, default to AzureDiagnostics. When set to Dedicated, logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy AzureDiagnostics table."
}
variable "retention_policy_enabled" {
type = bool
default = false
description = "Is this Retention Policy enabled?"
}
variable "days" {
type = number
default = "90"
description = " The number of days for which this Retention Policy should apply."
}

variable "Metric_enable" {
type = bool
default = true
Expand All @@ -143,11 +109,7 @@ variable "category" {
default = null
description = " The name of a Diagnostic Log Category Group for this Resource."
}
variable "log_enabled" {
type = string
default = true
description = " Is this Diagnostic Log enabled? Defaults to true."
}

variable "storage_account_id" {
type = string
default = null
Expand Down
5 changes: 2 additions & 3 deletions versions.tf
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Terraform version
terraform {
required_version = ">= 1.0.0"
required_version = ">= 1.7.8"
}

terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=3.0.0"
version = ">=3.39.0"
}
}
}