Org/Folder: Allow for policy association when using rule factory (#405)

* Org/Folder: Allow for policy association when using rule factory

* Fix linting issue
This commit is contained in:
Simone Ruffilli
2021-12-31 12:20:42 +01:00
committed by GitHub
parent 2bc5f7d33c
commit 640a5fe39c
4 changed files with 16 additions and 6 deletions

View File

@@ -57,10 +57,13 @@ module "folder" {
parent = "organizations/1234567890"
name = "Folder name"
firewall_policy_factory = {
cidr_file = "data/cidrs.yaml
cidr_file = "data/cidrs.yaml"
policy_name = null
rules_file = "data/rules.yaml"
}
firewall_policy_attachments = {
factory-policy = module.folder.firewall_policy_id["factory"]
}
}
# tftest:skip
```
@@ -70,7 +73,7 @@ module "folder" {
rfc1918:
- 10.0.0.0/8
- 172.168.0.0/12
- 172.16.0.0/12
- 192.168.0.0/16
```
@@ -220,6 +223,7 @@ module "folder2" {
```
<!-- BEGIN TFDOC -->
## Variables
@@ -254,3 +258,4 @@ module "folder2" {
<!-- END TFDOC -->

View File

@@ -24,7 +24,7 @@ output "firewall_policies" {
output "firewall_policy_id" {
description = "Map of firewall policy ids created in this folder."
value = {
for name, _ in var.firewall_policies :
for name, _ in local.firewall_policies :
name => google_compute_organization_security_policy.policy[name].id
}
}

View File

@@ -93,10 +93,13 @@ module "org" {
source = "./modules/organization"
organization_id = var.organization_id
firewall_policy_factory = {
cidr_file = "data/cidrs.yaml
cidr_file = "data/cidrs.yaml"
policy_name = null
rules_file = "data/rules.yaml"
}
firewall_policy_attachments = {
factory-policy = module.org.firewall_policy_id["factory"]
}
}
# tftest:skip
```
@@ -106,7 +109,7 @@ module "org" {
rfc1918:
- 10.0.0.0/8
- 172.168.0.0/12
- 172.16.0.0/12
- 192.168.0.0/16
```
@@ -236,6 +239,7 @@ module "org" {
```
<!-- BEGIN TFDOC -->
## Variables
@@ -273,3 +277,4 @@ module "org" {
<!-- END TFDOC -->

View File

@@ -44,7 +44,7 @@ output "firewall_policies" {
output "firewall_policy_id" {
description = "Map of firewall policy ids created in the organization."
value = {
for name, _ in var.firewall_policies :
for name, _ in local.firewall_policies :
name => google_compute_organization_security_policy.policy[name].id
}
}