aws-ia / terraform-aws-ipam

Terraform Module for create AWS IPAM Resources
https://registry.terraform.io/modules/aws-ia/ipam/aws/latest
Apache License 2.0
50 stars 31 forks source link

Terraform output Pool arn/ids #57

Closed jimsmith closed 1 year ago

jimsmith commented 1 year ago

Hello,

Thanks for this terraform module, can you please have the output of pool ids as well as these are more meaningful when passing these to different teams/projects.

I'm already using pool_names but can really be doing with the pool_ids alongside pool names.

jimsmith commented 1 year ago

For now, constructing this output works for my needs:

output "pools_information_level_1" {
  description = "List of pool information. (level 1)"
  value = {
    for key in keys(module.ipv4_scope.pools_level_1) :
      key => {
        arn = module.ipv4_scope.pools_level_1[key].arn
        id = module.ipv4_scope.pools_level_1[key].id
        ipam_scope_id = module.ipv4_scope.pools_level_1[key].ipam_scope_id
        ipam_scope_type = module.ipv4_scope.pools_level_1[key].ipam_scope_type
      }
  }
}
drewmullen commented 1 year ago

Hi thanks for opening this issue!

Our design was to output all the attributes of each resource rather than create an output or each or guess which outputs were necessary. The way you used outputs is in line with how we have designed it. Nice work!

Alternatively, teams consuming from a pool can use a data source to search for the pool vs handing them the ID

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_ipam_pool

jimsmith commented 1 year ago

Excellent thanks for that @drewmullen I'll close this issue as it's no longer an issue (thanks!)