After you create a custom routing Global Accelerator, it is a common practice to use the port mappings generated by the GA, for example as seen in this AWS blog post.
Right now, through Terraform, you can create a custom routing Global Accelerator, but there seems to be no way to get the port mappings information, leaving you with the alternative to run the following command with AWS CLI from Terraform (with something like terraform_data + local-exec; edit: or rather the external module) which is not ideal:
NOTE 2: The best practice is to list the port mappings after the Global Accelerator is in a "Deployed" state, in case this poses problems to any potential code that waits for a specific GA state to be ready during an apply.
NOTE 3: There is also another potential data source similar to this one that is more specific: ListCustomRoutingPortMappingsByDestination; you could consider including this one as well.
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
Volunteering to Work on This Issue
If you are interested in working on this issue, please leave a comment.
If this would be your first contribution, please review the contribution guide.
Description
After you create a custom routing Global Accelerator, it is a common practice to use the port mappings generated by the GA, for example as seen in this AWS blog post.
Right now, through Terraform, you can create a custom routing Global Accelerator, but there seems to be no way to get the port mappings information, leaving you with the alternative to run the following command with AWS CLI from Terraform (with something like
terraform_data
+local-exec
; edit: or rather theexternal
module) which is not ideal:It would be great to have access to this port mapping through a Terraform data source.
NOTE 1: The required API seems to be available in AWS Go SDK v2:
globalaccelerator#Client.ListCustomRoutingPortMappings
NOTE 2: The best practice is to list the port mappings after the Global Accelerator is in a "Deployed" state, in case this poses problems to any potential code that waits for a specific GA state to be ready during an apply.
NOTE 3: There is also another potential data source similar to this one that is more specific:
ListCustomRoutingPortMappingsByDestination
; you could consider including this one as well.Requested Resource(s) and/or Data Source(s)
aws_globalaccelerator_custom_routing_port_mappings
Potential Terraform Configuration
References
Would you like to implement a fix?
Yes