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 instance IPv6 addresses to the outputs #249

Merged
merged 1 commit into from
Nov 22, 2021
Merged

feat: Add instance IPv6 addresses to the outputs #249

merged 1 commit into from
Nov 22, 2021

Conversation

lucasvuotto
Copy link
Contributor

Description

Added an output for the ipv6_addresses of the AWS instances, similar to both public_ip and private_ip.

Motivation and Context

Motivation is the same as #241 . In particular, relying on aws_instance data source overly complicates working with IPv6 if using count or for_each in the module, having to split apply into 2 steps: one targeted for this module's instances, another one for the rest of the stuff, as you can't use a dynamic for_each in a data source:

╷
│ Error: Invalid for_each argument
│
│   on main.tf line 96, in data "aws_instance" "applied_ec2":
│   96:   for_each    = toset(module.ec2[*].id)
│     ├────────────────
│     │ module.ec2 is tuple with 1 element
│
│ The "for_each" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict how many instances will be created. To work
│ around this, use the -target argument to first apply only the resources that the for_each depends on.
╵

This is particular handy when the subnet the instance is placed in assigns IPv6 addresses at creation time, as neither ipv6_addresses or ipv6_addresses_count are required to be set in that case to get an IPv6 address.

Do note that aws_spot_instance_request resource doesn't offer a similar attribute, hence it isn't covered in this PR.

Breaking Changes

How Has This Been Tested?

  • I have tested and validated these changes using one or more of the provided examples/* projects

outputs.tf Outdated Show resolved Hide resolved
Copy link
Member

@bryantbiggs bryantbiggs left a comment

Choose a reason for hiding this comment

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

@antonbabenko 👍🏽

@antonbabenko antonbabenko merged commit 08bdf6a into terraform-aws-modules:master Nov 22, 2021
antonbabenko pushed a commit that referenced this pull request Nov 22, 2021
# [3.3.0](v3.2.1...v3.3.0) (2021-11-22)

### Features

* Add instance IPv6 addresses to the outputs ([#249](#249)) ([08bdf6a](08bdf6a))
@antonbabenko
Copy link
Member

This PR is included in version 3.3.0 🎉

@lucasvuotto lucasvuotto deleted the feature/instance-ipv6-addresses branch November 22, 2021 13:01
@github-actions
Copy link

github-actions bot commented Nov 8, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants