Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
johnricords committed Nov 8, 2023
1 parent 396c09d commit c16f3d6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.23.1 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.40.0 |

## Resources

Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 20 additions & 3 deletions tests/create_ipam_and_scope_create_pool/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
]
}
}

0 comments on commit c16f3d6

Please sign in to comment.