Skip to content

Commit

Permalink
fix: update github/workflows version and add module version
Browse files Browse the repository at this point in the history
  • Loading branch information
mamrajyadav committed Jan 3, 2024
1 parent 39b7fb5 commit a21e708
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto_assignee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch:
jobs:
assignee:
uses: clouddrove/github-shared-workflows/.github/workflows/auto_assignee.yml@1.0.8
uses: clouddrove/github-shared-workflows/.github/workflows/auto_assignee.yml@1.0.9
secrets:
GITHUB: ${{ secrets.GITHUB }}
with:
Expand Down
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@1.0.9
secrets:
GITHUB: ${{ secrets.GITHUB }}
with:
tfcheck: 'complete / Get min/max versions'
...
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch:
jobs:
changelog:
uses: clouddrove/github-shared-workflows/.github/workflows/changelog.yml@1.0.8
uses: clouddrove/github-shared-workflows/.github/workflows/changelog.yml@1.0.9
secrets: inherit
with:
branch: 'master'
6 changes: 3 additions & 3 deletions .github/workflows/tf-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ on:
workflow_dispatch:
jobs:
basic-example:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@1.0.8
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@1.0.9
with:
working_directory: './_example/basic/'

complete-example:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@1.0.8
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@1.0.9
with:
working_directory: './_example/complete/'

nsg-with-flow-logs-example:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@1.0.8
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@1.0.9
with:
working_directory: './_example/nsg-with-flow-logs/'
2 changes: 1 addition & 1 deletion .github/workflows/tflint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ on:
workflow_dispatch:
jobs:
tf-lint:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-lint.yml@1.0.8
uses: clouddrove/github-shared-workflows/.github/workflows/tf-lint.yml@1.0.9
secrets:
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 @@ -5,7 +5,7 @@ on:
workflow_dispatch:
jobs:
tfsec:
uses: clouddrove/github-shared-workflows/.github/workflows/tfsec.yml@1.0.8
uses: clouddrove/github-shared-workflows/.github/workflows/tfsec.yml@1.0.9
secrets: inherit
with:
working_directory: '.'
4 changes: 2 additions & 2 deletions _example/basic/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ module "network_security_group" {
source = "../../"
name = local.name
environment = local.environment
resource_group_name = "app-storage-test-resource-group"
resource_group_name = "app-subnet-test-resource-group"
resource_group_location = "North Europe"
subnet_ids = ["/subscriptions/068245d4-3c94-42fe-9c4d-9e5e1cabc60c/resourceGroups/"]
subnet_ids = ["xxxxxxxxxxx"]
inbound_rules = [
{
name = "ssh"
Expand Down
12 changes: 6 additions & 6 deletions _example/complete/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,28 @@ module "resource_group" {
## Virtual Network module call.
##-----------------------------------------------------------------------------
module "vnet" {
depends_on = [module.resource_group]
source = "clouddrove/vnet/azure"
version = "1.0.3"
depends_on = [module.resource_group]
source = "clouddrove/vnet/azure"
version = "1.0.4"
name = local.name
environment = local.environment
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location
address_space = "10.30.0.0/22"
address_spaces = ["10.30.0.0/22"]
}

##-----------------------------------------------------------------------------
## Subnet Module call.
## Subnet to which network security group will be attached.
##-----------------------------------------------------------------------------
module "subnet" {
source = "clouddrove/subnet/azure"
source = "clouddrove/subnet/azure"
version = "1.0.2"
name = local.name
environment = local.environment
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location
virtual_network_name = join("", module.vnet.vnet_name)
virtual_network_name = module.vnet.vnet_name
# Subnet Configuration
subnet_names = ["subnet"]
subnet_prefixes = ["10.30.0.0/24"]
Expand Down
6 changes: 3 additions & 3 deletions _example/complete/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ output "resource_group_name" {
}

output "resource_group_location" {
description = "The name of the resource group in which the subnet is created in."
value = module.resource_group.resource_group_location
description = "The name of the resource group in which the subnet is created in."
}

output "virtual_network_name" {
value = module.vnet.vnet_name
description = "The name of the virtual network in which the subnet is created in."
value = join("", module.vnet.vnet_name)
}

output "address_prefixes" {
Expand All @@ -34,8 +34,8 @@ output "route_table_id" {
}

output "route_table_associated_subnets" {
description = "The collection of Subnets associated with this route table."
value = module.subnet[*].route_table_associated_subnets
description = "The collection of Subnets associated with this route table."
}

output "security_group_id" {
Expand Down
10 changes: 5 additions & 5 deletions _example/nsg-with-flow-logs/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ module "resource_group" {
module "vnet" {
depends_on = [module.resource_group]
source = "clouddrove/vnet/azure"
version = "1.0.3"
version = "1.0.4"
name = local.name
environment = local.environment
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location
address_space = "10.30.0.0/22"
address_spaces = ["10.30.0.0/22"]
enable_network_watcher = true
}

Expand All @@ -47,7 +47,7 @@ module "subnet" {
environment = local.environment
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location
virtual_network_name = join("", module.vnet.vnet_name)
virtual_network_name = module.vnet.vnet_name
# Subnet Configuration
subnet_names = ["subnet"]
subnet_prefixes = ["10.30.0.0/24"]
Expand Down Expand Up @@ -76,7 +76,7 @@ module "storage" {
default_enabled = true
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location
storage_account_name = "jdjkdkh787"
storage_account_name = "djshfjdh465"
## Storage Container
containers_list = [
{ name = "app-test", access_type = "private" },
Expand All @@ -92,7 +92,7 @@ module "storage" {
queues = ["queue1"]
management_policy_enable = true
#enable private endpoint
virtual_network_id = module.vnet.vnet_id[0]
virtual_network_id = module.vnet.vnet_id
subnet_id = module.subnet.default_subnet_id[0]
enable_diagnostic = false
}
Expand Down
2 changes: 1 addition & 1 deletion _example/nsg-with-flow-logs/ouputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ output "resource_group_location" {

output "virtual_network_name" {
description = "The name of the virtual network in which the subnet is created in."
value = join("", module.vnet.vnet_name)
value = module.vnet.vnet_name
}

output "address_prefixes" {
Expand Down
8 changes: 4 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ resource "azurerm_network_security_group" "nsg" {
resource "azurerm_network_security_rule" "inbound" {
for_each = { for rule in var.inbound_rules : rule.name => rule }
resource_group_name = var.resource_group_name
network_security_group_name = join("", azurerm_network_security_group.nsg[*].name)
network_security_group_name = azurerm_network_security_group.nsg[0].name
direction = "Inbound"
name = each.value.name
priority = each.value.priority
Expand Down Expand Up @@ -66,7 +66,7 @@ resource "azurerm_network_security_rule" "inbound" {
resource "azurerm_network_security_rule" "outbound" {
for_each = { for rule in var.outbound_rules : rule.name => rule }
resource_group_name = var.resource_group_name
network_security_group_name = join("", azurerm_network_security_group.nsg[*].name)
network_security_group_name = azurerm_network_security_group.nsg[0].name
direction = "Outbound"
name = each.value.name
priority = each.value.priority
Expand Down Expand Up @@ -96,7 +96,7 @@ resource "azurerm_network_security_rule" "outbound" {
resource "azurerm_subnet_network_security_group_association" "example" {
count = var.enabled ? length(var.subnet_ids) : 0
subnet_id = element(var.subnet_ids, count.index)
network_security_group_id = join("", azurerm_network_security_group.nsg[*].id)
network_security_group_id = azurerm_network_security_group.nsg[0].id
}

##-----------------------------------------------------------------------------
Expand All @@ -110,7 +110,7 @@ resource "azurerm_network_watcher_flow_log" "nsg_flow_logs" {
version = var.flow_log_version
network_watcher_name = var.network_watcher_name
resource_group_name = var.resource_group_name
network_security_group_id = join("", azurerm_network_security_group.nsg[*].id)
network_security_group_id = azurerm_network_security_group.nsg[0].id
storage_account_id = var.flow_log_storage_account_id
retention_policy {
enabled = var.flow_log_retention_policy_enabled
Expand Down
10 changes: 5 additions & 5 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
output "id" {
value = join("", azurerm_network_security_group.nsg[*].id)
value = azurerm_network_security_group.nsg[0].id
description = "The network security group configuration ID."
}

output "name" {
value = join("", azurerm_network_security_group.nsg[*].name)
value = azurerm_network_security_group.nsg[0].name
description = "The name of the network security group."
}

Expand All @@ -14,16 +14,16 @@ output "tags" {
}

output "subnet_id" {
value = join("", azurerm_subnet_network_security_group_association.example[*].subnet_id)
value = azurerm_subnet_network_security_group_association.example[0].subnet_id
description = "The ID of the Subnet. Changing this forces a new resource to be created."
}

output "network_watcher_name" {
value = join("", azurerm_network_watcher_flow_log.nsg_flow_logs[*].name)
value = var.enabled && var.enable_flow_logs ? azurerm_network_watcher_flow_log.nsg_flow_logs[0].name : null
description = "The name of the Network Watcher. Changing this forces a new resource to be created."
}

output "storage_account_id" {
value = join("", azurerm_network_watcher_flow_log.nsg_flow_logs[*].storage_account_id)
value = var.enabled && var.enable_flow_logs ? azurerm_network_watcher_flow_log.nsg_flow_logs[0].storage_account_id : null
description = "The ID of the Storage Account where flow logs are stored."
}

0 comments on commit a21e708

Please sign in to comment.