-
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
Modifying aws_instance.user_data triggers a stop then start but does not update output #24690
Comments
Met the same issue today. resource "aws_instance" "my_bastion_host" {
ami = var.ami
instance_type = var.instance_type
tags = {
Name = var.name
}
key_name = var.key_name
subnet_id = data.aws_subnet.public_subnet.id
vpc_security_group_ids = [aws_security_group.public_ec2_security_group.id]
# provisioner "remote-exec" {
# inline = [
# "sudo yum -y update",
# "sudo yum -y install socat",
# ]
# }
user_data = <<EOF
#!/bin/bash
sudo yum -y update
sudo yum -y install socat
EOF
}
output "ssh" {
value = format("ssh -i ~/.ssh/%s.pem ec2-user@%s",var.key_name,aws_instance.my_bastion_host.public_dns)
} I tried to use At last, I have to use |
Warning This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them. Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed. |
This functionality has been released in v5.83.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! |
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. |
Community Note
Terraform CLI and Terraform AWS Provider Version
Terraform v1.1.9
on darwin_arm64
Affected Resource(s)
Terraform Configuration Files
Debug Output
https://gist.github.com/rubiconjosh/bc83076453ca7fdd97bbf7fc0728c444
Panic Output
N/A
Expected Behavior
As documented when user_data is modified a stop/start will be triggered on
aws_instance.example
. This will cause the public IP of the instance to change.output.public_ip
would reflect the new values ofaws_instance.example.public_ip
.Actual Behavior
When
user_data
was modified onaws_instance.example
a stop/start was triggered.output.public_ip
still reflects the original public ip.Steps to Reproduce
terraform apply
user_data = "#"
toaws_instance.example
terraform apply
Important Factoids
I see the new pubic IP mentioned in the debug log:
Inspecting state shows that
aws_instance.example.public_ip
contains the new value,output.public_ip
does not.References
The text was updated successfully, but these errors were encountered: