Skip to content

Commit

Permalink
fix : added deprecated attributes, labels and output.tf
Browse files Browse the repository at this point in the history
  • Loading branch information
pranaydeokar committed Jan 3, 2024
1 parent 8f124ea commit 0162c05
Show file tree
Hide file tree
Showing 11 changed files with 253 additions and 74 deletions.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,17 @@ updates:
# Allow up to 3 open pull requests for pip dependencies
open-pull-requests-limit: 3

- package-ecosystem: "terraform" # See documentation for possible values
directory: "/_example/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


5 changes: 5 additions & 0 deletions .github/workflows/tf-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@ jobs:
uses: clouddrove/github-shared-workflows/.github/workflows/[email protected]
with:
working_directory: './_example/complete/'

basic-example:
uses: clouddrove/github-shared-workflows/.github/workflows/[email protected]
with:
working_directory: './_example/basic/'


21 changes: 14 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.130.0

- repo: https://github.com/gruntwork-io/pre-commit
rev: v0.1.12 # Get the latest from: https://github.com/gruntwork-io/pre-commit/releases
hooks:
- id: terraform_fmt
- id: terraform_tflint
- id: terraform-fmt
- id: shellcheck
- id: tflint

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1 # Use the ref you want to point at
hooks:
- id: check-merge-conflict
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
- id: check-byte-order-marker
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: debug-statements
- id: check-yaml
- id: check-added-large-files
4 changes: 3 additions & 1 deletion README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ usage: |-
subnet_id = module.name_specific_subnet.specific_subnet_id[0]
#### enable diagnostic setting
diagnostic_setting_enable = false
diagnostic_setting_enable = true
log_analytics_workspace_id = ""
}
```
29 changes: 22 additions & 7 deletions _example/complete/main.tf → _example/basic/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@ provider "azurerm" {
features {}
}

module "resource_group" {
source = "clouddrove/resource-group/azure"
version = "1.0.2"
locals {
name = "app"
environment = "test"
label_order = ["name", "environment"]
}

module "resource_group" {
source = "clouddrove/resource-group/azure"
version = "1.0.2"
name = "app"
environment = "test"
label_order = ["name", "environment"]
location = "Canada Central"
}

##-----------------------------------------------------------------------------
## Virtual Network module call.
##-----------------------------------------------------------------------------
module "vnet" {
source = "clouddrove/vnet/azure"
version = "1.0.4"
Expand All @@ -22,6 +30,9 @@ module "vnet" {
address_spaces = ["10.0.0.0/16"]
}

##-----------------------------------------------------------------------------
## Subnet module call.
##-----------------------------------------------------------------------------
module "name_specific_subnet" {
source = "clouddrove/subnet/azure"
version = "1.0.2"
Expand All @@ -38,7 +49,9 @@ module "name_specific_subnet" {
enable_route_table = false

}

##-----------------------------------------------------------------------------
## Bastion module call.
##-----------------------------------------------------------------------------
module "bastion" {
depends_on = [module.resource_group]
source = "./../../"
Expand All @@ -49,7 +62,9 @@ module "bastion" {
virtual_network_name = module.vnet.vnet_name
subnet_id = module.name_specific_subnet.specific_subnet_id[0]

#### enable diagnostic setting
diagnostic_setting_enable = false
log_analytics_workspace_id = ""
##-----------------------------------------------------------------------------
## enable diagnostic setting
##-----------------------------------------------------------------------------
diagnostic_setting_enable = false

}
14 changes: 14 additions & 0 deletions _example/basic/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
output "bastion_dns_name" {
value = join("", module.bastion.*.dns_name)

Check warning on line 2 in _example/basic/outputs.tf

View workflow job for this annotation

GitHub Actions / tf-lint / tflint

List items should be accessed using square brackets
description = "Specifies the name of the bastion host"
}

output "bastion_id" {
value = join("", module.bastion.*.id)
description = "Specifies the name of the bastion host"
}





13 changes: 13 additions & 0 deletions _example/basic/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Terraform version
terraform {
required_version = ">= 1.6.6"
}

terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=3.85.0"
}
}
}
94 changes: 94 additions & 0 deletions _example/complete/example.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
provider "azurerm" {
features {}
}

locals {
name = "app"
environment = "test"
label_order = ["name", "environment"]
}

##-----------------------------------------------------------------------------
## Resource Group module call
## Resource group in which all resources will be deployed.
##-----------------------------------------------------------------------------
module "resource_group" {
source = "clouddrove/resource-group/azure"
version = "1.0.2"
name = "app"
environment = "test"
label_order = ["name", "environment"]
location = "Canada Central"
}

##-----------------------------------------------------------------------------
## Virtual Network module call.
##-----------------------------------------------------------------------------
module "vnet" {
source = "clouddrove/vnet/azure"
version = "1.0.4"
name = "app"
environment = "test"
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location
address_spaces = ["10.0.0.0/16"]
}

##-----------------------------------------------------------------------------
## Subnet module call.
##-----------------------------------------------------------------------------
module "name_specific_subnet" {
source = "clouddrove/subnet/azure"
version = "1.0.2"
name = "app"
environment = "test"
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location
virtual_network_name = module.vnet.vnet_name

#subnet
specific_name_subnet = true
specific_subnet_names = "AzureBastionSubnet"
subnet_prefixes = ["10.0.1.0/24"]
enable_route_table = false

}

##-----------------------------------------------------------------------------
## Log Analytics module call.
## Log analytics workspace in which storage diagnostic logs will be sent.
##-----------------------------------------------------------------------------
module "log-analytics" {
source = "clouddrove/log-analytics/azure"
version = "1.0.1"
name = local.name
environment = local.environment
label_order = local.label_order
create_log_analytics_workspace = true
log_analytics_workspace_sku = "PerGB2018"
daily_quota_gb = "-1"
internet_ingestion_enabled = true
internet_query_enabled = true
resource_group_name = module.resource_group.resource_group_name
log_analytics_workspace_location = module.resource_group.resource_group_location
}

##-----------------------------------------------------------------------------
## Bastion module call.
##-----------------------------------------------------------------------------
module "bastion" {
depends_on = [module.resource_group]
source = "./../../"
name = "app"
environment = "test"
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location
virtual_network_name = module.vnet.vnet_name
subnet_id = module.name_specific_subnet.specific_subnet_id[0]

##-----------------------------------------------------------------------------
## enable diagnostic setting
##-----------------------------------------------------------------------------
diagnostic_setting_enable = true
log_analytics_workspace_id = module.log-analytics.workspace_id
}
28 changes: 14 additions & 14 deletions _example/complete/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#output "bastion_dns_name" {
# value = join("", module.bastion.*.dns_name)
# description = "Specifies the name of the bastion host"
#}
#
#output "bastion_id" {
# value = join("", module.bastion.*.id)
# description = "Specifies the name of the bastion host"
#}
#
#
#
#
#
output "bastion_dns_name" {
value = join("", module.bastion.*.dns_name)
description = "Specifies the name of the bastion host"
}

output "bastion_id" {
value = join("", module.bastion.*.id)
description = "Specifies the name of the bastion host"
}





Loading

0 comments on commit 0162c05

Please sign in to comment.