Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add outputs for the full list of subnets created and their attributes #1116

Conversation

certara-mchamberland
Copy link
Contributor

Description

This adds outputs mapping subnet IDs to AZs. This allows comparing AZs with a remote PrivateLink Endpoint Service to find out in what subnet we can create an endpoint locally, as PrivateLink requires both ends use the same AZs.

Breaking Changes

No, these are only new outputs.

How Has This Been Tested?

  • I have updated at least one of the examples/* to demonstrate and validate my change(s) - Not sure its relevant for outputs

  • I have tested and validated these changes using one or more of the provided examples/* projects - I applied it directly to a module of mine that, among other things, locates matching AZs on both ends of a PrivateLink VPC Endpoint

  • I have executed pre-commit run -a on my pull request

@certara-mchamberland certara-mchamberland changed the title Add new outputs mapping subnet IDs to AZs feat: Add new outputs mapping subnet IDs to AZs Sep 4, 2024
@certara-jgitlin
Copy link

LGTM! 👍

Copy link

github-actions bot commented Oct 6, 2024

This PR has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this PR will be closed in 10 days

@github-actions github-actions bot added the stale label Oct 6, 2024
@certara-mchamberland
Copy link
Contributor Author

Could a maintainer pls take a look at this? I'm happy to keep working on it if its not currently adequate. Thanks!

@github-actions github-actions bot removed the stale label Oct 10, 2024
outputs.tf Outdated
@@ -155,6 +155,11 @@ output "public_network_acl_arn" {
value = try(aws_network_acl.public[0].arn, null)
}

output "public_subnet_az_mapping" {
description = "A mapping of public subnet IDs to Availability Zones, useful when deploying PrivateLink endpoint services, which require matching AZs on both ends."
value = { for subnet in aws_subnet.public[*] : (subnet["id"]) => subnet["availability_zone"] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than this custom mapping, I think a better approach would be to just output all attributes of the subnets created and let users use those as they please (you can use this to create this mapping for example in your own implementation)

output "public_subnets" {
  description = "List of the subnets created and their associate attributes"
  value       = aws_subnet.public
}

Copy link
Contributor Author

@certara-mchamberland certara-mchamberland Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd built it this way to avoid a breaking change, hoping for a fast release, but I can arrange this too. Right now my org is working from my fork anyways. Alternatively, I could submit a second PR implementing the "breaking change" for merge in the next major version, your call! You're still suggesting a new output, so not a breaking change. Ignore me, I'll update the PR as you requested when time allows. Thanks!

outputs.tf Outdated
@@ -105,6 +105,11 @@ output "igw_arn" {
# Publiс Subnets
################################################################################

output "public_subnet_objects" {
description = "A list of all public subnets, containing the full objects."
value = aws_subnet.public[*]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for the [*], they can all be dropped if they are the last attribute selector

Suggested change
value = aws_subnet.public[*]
value = aws_subnet.public

@bryantbiggs bryantbiggs changed the title feat: Add new outputs mapping subnet IDs to AZs feat: Add outputs for the full list of subnets created and their attributes Oct 18, 2024
@bryantbiggs bryantbiggs merged commit e212245 into terraform-aws-modules:master Oct 18, 2024
19 checks passed
antonbabenko pushed a commit that referenced this pull request Oct 18, 2024
## [5.14.0](v5.13.0...v5.14.0) (2024-10-18)

### Features

* Add outputs for the full list of subnets created and their attributes ([#1116](#1116)) ([e212245](e212245))

### Bug Fixes

* Update CI workflow versions to latest ([#1125](#1125)) ([b1f2125](b1f2125))
@antonbabenko
Copy link
Member

This PR is included in version 5.14.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants