-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Tags not being assigned to Elastic IP instances #18756
Comments
@tomerickson-es Thanks for raising this issue! Also, thanks for all the excellent detail. That will make it easier to track down. Sometimes these problems are intermittent. It is rare to have differences between OS flavors but it can happen. Have you been able to replicate the results consistently? Again, thanks and sorry for the trouble. |
@YakDriver i pinned our code to use hashicorp/aws 3.36.0 and deployed from my macbook, and that also results in the error where the tags are not assigned to the EIP. i think your suspicion that this is a bug in 3.36.0 regardless of OS is probably correct. thanks for following up! |
Related: #18847 @tomerickson-es which AWS region is this configuration running in? |
I am the author of the change to EIP tagging which was released in 3.36.0. I just saw this issue so I'll be trying to reproduce this today and hopefully help find a resolution soon. More details on the change can be found here: The only information I can add at this point is that the change was tested manually on both an older EC2 Classic account and a newer VPC style account. Also, the relevant acceptance tests were run. But it appears that something was missed so I'll try to figure out what's going on. By the way, I know it is a pain to redact sensitive data, but debug output |
@rick-masters i updated my sample program to be fully standalone, and recreated the issue. the new module is below and the resulting logs for TF_LOG=TRACE are attached. I ran this by setting env vars AWS_PROFILE=default Then I copied the module to a new working directory, ran I did notice the following somewhat ominous lines in the trace log output, very near the end 2021/04/15 13:23:53 [WARN] Provider "registry.terraform.io/hashicorp/aws" produced an unexpected new value for aws_eip.node_eip, but we are tolerating it because it is using the legacy plugin SDK.
The following problems may be the cause of any confusing errors from downstream operations:
- .customer_owned_ipv4_pool: was null, but now cty.StringVal("")
- .tags: element "Name" has vanished
- .tags: element "NodeName" has vanished I hope all this helps data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["ami-ubuntu-16.04-*"]
}
owners = ["285398391915"] # Canonical
}
resource "aws_vpc" "vpc" {
cidr_block = "10.1.0.0/16"
tags = {
Name = "test-foo-VPC"
}
}
resource "aws_internet_gateway" "igw" {
vpc_id = aws_vpc.vpc.id
tags = {
Name = "test-foo-IGW"
}
}
resource "aws_subnet" "public-subnet" {
availability_zone = "us-east-2a"
cidr_block = "10.1.0.0/16"
map_public_ip_on_launch = true # makes it public
vpc_id = aws_vpc.vpc.id
tags = {
Name = "test-foo-vpc-Public1"
}
}
resource "aws_route_table" "route-table" {
vpc_id = aws_vpc.vpc.id
route {
cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.igw.id
}
tags = {
Name = "test-foo-Route-Table"
}
}
resource "aws_route_table_association" "public-subnet-associations-managed" {
route_table_id = aws_route_table.route-table.id
subnet_id = aws_subnet.public-subnet.id
}
# EC2 section
resource aws_instance "nodes" {
ami = data.aws_ami.ubuntu.id
instance_type = "t2.medium"
availability_zone = "us-east-2a"
subnet_id = aws_subnet.public-subnet.id
tags = {
Name = "test-foo"
}
}
resource "aws_eip" "node_eip" {
instance = aws_instance.nodes.id
tags = {
Name = "test-foo-node-01-eip"
NodeName = "test-foo-node-01"
}
}
terraform {
required_version = "~> 0.14.5"
required_providers {
aws = {
source = "hashicorp/aws"
version = "3.36.0"
}
}
} |
Thanks @tomerickson-es that helps so I can make sure I have the same sdk version and so forth. I have the log file if you want to delete it now. |
@tomerickson-es What is strange is that your experience appears to be that terraform was able to set the tags for "standard" eips in 3.35.0. That was not my understanding of the old behavior and there was code in the provider which explicitly avoided setting tags for "standard" eips:
Upon further inspection, I'm suspecting that this statement never actually worked and then when I rewrote it as part of the tagging change [1], I made it work correctly, but that actually caused trouble. It will take me some time to confirm that, and if so, that check will need to be removed entirely, but for now I think |
I know what this issue is. If your account/region does not support EC2 Classic, then the EIP will default to type vpc (not standard) even if you do not specify It was a mistake on my part for overlooking that behavior. Sorry about that. I've written a new change which only errors out if there are tags and This issue should be flagged as a regression. A pull request is forthcoming. |
It will take me a while to put together a pull request and test it properly, but if anyone would like to see the fix right now, this is what I have in progress:
|
@rick-masters That makes sense as to why it is not affecting everyone. Thank you for the explanation. If you are able to put together even a simple PR, before you finish testing, I can start testing on my end as well. Ideally, I'd like to get a fix in today. The release has been pushed to tomorrow. If not, no worries. We can work up a PR on this end also. Just let me know. |
@YakDriver ok, working on a PR... |
@YakDriver PR posted, started more testing |
This has been released in version 3.37.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 for triage. Thanks! |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Regression
Relates #17612
Terraform CLI and Terraform AWS Provider Version
ubuntu@ip-10-1-10-161:~/sandbox$ terraform -v
Terraform v0.14.5
Affected Resource(s)
Terraform Configuration Files
Debug Output
N/A
Panic Output
N/A
Expected Behavior
The two tags specified in the aws_eip declaration should be present when viewing the Tags section of the Elastic IP from the AWS Console.
Actual Behavior
No Tags are present.
Steps to Reproduce
terraform apply
Important Factoids
terraform apply
again from the Ubuntu 20.04 test machine, terraform indicates the aws_eip will be updated in-place, with the changes being to add the two tags. looks like the provider supports the tags, but somehow not on the initial deployment of the resource. output from thatapply
operation is belowReferences
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip
The text was updated successfully, but these errors were encountered: