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

[Bug]: enable IPv6, apply error occurred #32897

Closed
watarukura opened this issue Aug 8, 2023 · 3 comments · Fixed by #32896
Closed

[Bug]: enable IPv6, apply error occurred #32897

watarukura opened this issue Aug 8, 2023 · 3 comments · Fixed by #32896
Labels
bug Addresses a defect in current functionality. service/vpc Issues and PRs that pertain to the vpc service.
Milestone

Comments

@watarukura
Copy link
Contributor

watarukura commented Aug 8, 2023

Terraform Core Version

1.5.4

AWS Provider Version

5.11.0

Affected Resource(s)

  • aws_subnet

Expected Behavior

The expected behavior was to associate an ipv6_cidr_block with an aws_subnet where ipv6_cidr_block was originally null. At the same time, I intended to set enable_dns64 and enable_resource_name_dns_aaaa_record_on_launch to true.

  # module.network.module.subnet["subnet-1a_1"].aws_subnet.this will be updated in-place
  ~ resource "aws_subnet" "this" {
      ~ assign_ipv6_address_on_creation                = false -> (known after apply)
      ~ enable_dns64                                   = false -> (known after apply)
      ~ enable_resource_name_dns_aaaa_record_on_launch = false -> (known after apply)
        id                                             = "subnet-0cf3edac22636b4fa"
      + ipv6_cidr_block                                = (known after apply)
        tags                                           = {
            "Name" = "subnet-1a_1"
        }
        # (13 unchanged attributes hidden)
    }

Actual Behavior

the actual behavior encountered an error, preventing the ability to set enable_dns64 to true due to the requirement of having an associated ipv6_cidr_block.

Relevant Error/Panic Output Snippet

Error: modifying EC2 Subnet (subnet-0cf3edac22636b4fa) EnableDns64: InvalidParameterValue: Invalid value 'true' for enable-dns64. Cannot set enable-dns64 to true unless the subnet (subnet-0cf3edac22636b4fa) has an IPv6 CIDR block associated with it.
	status code: 400, request id: 06223ea1-c744-421f-bed1-7801a1532c10

  with module.network.module.subnet["subnet-1a_1"].aws_subnet.this,
  on .terraform/modules/network.subnet/aws/subnet/subnet.tf line 6, in resource "aws_subnet" "this":
   6: resource "aws_subnet" "this" {

Terraform Configuration Files

terraform {
  required_version = ">= 1.1.0"
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 5.0.0"
    }
  }
}

Steps to Reproduce

1. Create IPv4 only vpc and subnet

locals {
  cidr_block = "172.31.0.0/16"
  az         = "ap-northeast-1a"
  subnet_cidr_block = cidrsubnet(local.cidr_block, 8, 1)
}

resource "aws_vpc" "vpc" {
  cidr_block                       = local.cidr_block
  assign_generated_ipv6_cidr_block = false
}

resource "aws_internet_gateway" "gateway" {
  vpc_id = aws_vpc.vpc.id
}

resource "aws_subnet" "this" {
  cidr_block        = local.subnet_cidr_block
  vpc_id            = aws_vpc.vpc.id
  availability_zone = local.az

  ipv6_cidr_block                                = null
  enable_dns64                                   = false
  assign_ipv6_address_on_creation                = false
  enable_resource_name_dns_aaaa_record_on_launch = false
}

2. Enable IPv6

locals {
  cidr_block = "172.31.0.0/16"
  az         = "ap-northeast-1a"
  subnet_cidr_block = cidrsubnet(local.cidr_block, 8, 1)
}

resource "aws_vpc" "vpc" {
  cidr_block                       = local.cidr_block
  assign_generated_ipv6_cidr_block = false
}

resource "aws_internet_gateway" "gateway" {
  vpc_id = aws_vpc.vpc.id
}

resource "aws_subnet" "this" {
  cidr_block        = local.subnet_cidr_block
  vpc_id            = aws_vpc.vpc.id
  availability_zone = local.az

  ipv6_cidr_block                                = cidrsubnet(aws_vpc.vpc.ipv6_cidr_block, 8, 1)
  enable_dns64                                   = true
  assign_ipv6_address_on_creation                = true
  enable_resource_name_dns_aaaa_record_on_launch = true
}

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

Yes

@watarukura watarukura added the bug Addresses a defect in current functionality. label Aug 8, 2023
@github-actions
Copy link

github-actions bot commented Aug 8, 2023

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.

@github-actions github-actions bot added the service/vpc Issues and PRs that pertain to the vpc service. label Aug 8, 2023
@github-actions github-actions bot added this to the v5.13.0 milestone Aug 11, 2023
@github-actions
Copy link

This functionality has been released in v5.13.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this issue 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 similar to this, 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 Sep 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/vpc Issues and PRs that pertain to the vpc service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant