From c16f3d6f8478e37cf8bf9995705ad8d87f68beab Mon Sep 17 00:00:00 2001 From: John Ricords <122303445+johnricords@users.noreply.github.com> Date: Wed, 8 Nov 2023 10:26:29 -0500 Subject: [PATCH] tweak --- README.md | 2 +- main.tf | 2 +- .../create_ipam_and_scope_create_pool/main.tf | 23 ++++++++++++++++--- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1818db7..933c8cc 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ | Name | Version | |------|---------| -| [aws](#provider\_aws) | 5.23.1 | +| [aws](#provider\_aws) | >= 4.40.0 | ## Resources diff --git a/main.tf b/main.tf index 72c9d74..a099c1d 100644 --- a/main.tf +++ b/main.tf @@ -25,7 +25,7 @@ resource "aws_vpc_ipam_pool" "this" { auto_import = each.value.auto_import aws_service = try(lower(each.value.aws_service), null) description = each.value.description - ipam_scope_id = try((var.vpc_ipam.pools.public_ip_source != "" ? [aws_vpc_ipam.this[0].public_default_scope_id] : []), (aws_vpc_ipam_scope.this.id), (each.value.ipam_scope_id)) + ipam_scope_id = try((var.vpc_ipam.pools.public_ip_source != "" ? [aws_vpc_ipam.this[0].public_default_scope_id] : []), (aws_vpc_ipam_scope.this[0].id), (each.value.ipam_scope_id)) # could also create attribute is_public instead of var.vpc_ipam.pools.public_ip_source != "" # try doesn't account for multiple scopes with a sub pool created with different scopeids (but aws_vpc_ipam_scope.this.id) is valid diff --git a/tests/create_ipam_and_scope_create_pool/main.tf b/tests/create_ipam_and_scope_create_pool/main.tf index 20bd291..ec997aa 100644 --- a/tests/create_ipam_and_scope_create_pool/main.tf +++ b/tests/create_ipam_and_scope_create_pool/main.tf @@ -17,22 +17,39 @@ module "create_ipam" { cascade = true description = random_string.this.result } + scopes = [ + { + name = "high_level_container" + ipam_id = module.create_ipam[0].aws_vpc_ipam_pool.this[0] + description = random_string.this.result + tags = { + name = "broker_managed" + } + }, + ] + } +} + +module "create_pool" { + source = "../.." + + vpc_ipam = { + pools = [ { name = "pool_of_cidrs" address_family = "ipv4" allocation_default_netmask_length = "16" allocation_min_netmask_length = "16" - allocation_max_netmask_length = "24" + allocation_max_netmask_length = "16" description = random_string.this.result locale = "us-east-1" tags = { name = "broker_managed" } - ipam_scope_id = module.scope.scope["high_level_container"].id + ipam_scope_id = module.create_ipam.scope["high_level_container"].id #can also be output of vpc_ipam.scope, need to tweak to check @ implementation }, ] } } -