-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Setup seems to cause aws_instance to be constantly re-created #3262
Comments
Hey @timothykimball – it looks like something specific to your block devices:
When you create this instance, does the console show both devices? |
@catsby - I am not sure what you mean. I blew away the environment and did the plan brand new
|
Sorry if I was vague, what I meant by that was, after you first apply the plan, how many block devices do you see in the AWS Console, for this Instance? |
@catsby - just pinging here. Still having this problem. |
Hey @timothykimball thanks for the ping. I apologize for the trouble you've had here and the silence. The root of the issue here is the mixing of inline The workaround here would be to either internalize the An example of externalizing: resource "aws_volume_attachment" "ebs_att" {
device_name = "/dev/xvdc"
volume_id = "${aws_ebs_volume.encrypted_ebs.id}"
instance_id = "${aws_instance.ana.id}"
}
resource "aws_ebs_volume" "encrypted_ebs" {
availability_zone = "us-west-2a"
type = "gp2"
size = "8"
encrypted = "true"
}
resource "aws_volume_attachment" "other_att" {
device_name = "/dev/sdb"
volume_id = "${aws_ebs_volume.other_ebs.id}"
instance_id = "${aws_instance.ana.id}"
}
resource "aws_ebs_volume" "other_ebs" {
availability_zone = "us-west-2a"
type = "gp2"
size = "32"
encrypted = "true"
}
resource "aws_instance" "ana" {
tags {
Name = "device_test"
}
ami = "ami-dfc39aef"
availability_zone = "us-west-2a"
instance_type = "t2.micro"
root_block_device {
delete_on_termination = true
}
disable_api_termination = false
lifecycle {
prevent_destroy = false
}
} I realize the experience here isn't that great, and I apologize. We don't currently support the idea of "additive" sub-resources ( While this kind of partial matching is a feature I would like to add, it hasn't been discussed much internally and so I can't say if it will be included in the future. I apologize again for the sub-par experience here, and too for leaving you hanging for ~9 days without a reply 😦 I'm going to close this issue now, but please feel free to follow up with any other questions you may have. Thanks again! |
Cool. Thanks for the reply. Just a question: If it is not supported, why am I able to declare it in the config? Should there be some logic that spits out an error if I am doing something unsupported? Thanks for the example. I will give it a go. |
The core of Terraform uses a graph to determine relationships and ordering of resources for creation/update/etc. The core doesn't know much about those resources, or what they need or how the should be validated, just that they exist and they depend on each other in certain ways. The resources themselves don't know about other resources in the graph, they just get the information they need in the order/time they need it from the core. The problem here is that while we can validate ordering in the graph, we don't yet have any support for resource to resource validations like this, e.g. "this resource can not both define EBS devices and be a part of a To answer your question, yes, there should be something to prevent or at least warn about this. But we don't have it yet. I've opened #3511 specifically for this conflict, though I imagine the actual fix will be a larger core change/addition. Thanks again 😄 let me know if you have any other questions. |
Hey @timothykimball – Terraform v0.6.4 introduce a ignore_changes configuration option, can you see if that's a viable workaround here? By ignoring changes to the |
* oss/master: Add 'discard' target to file audit backend (hashicorp#3262) changelog++ auth/aws: Allow wildcard in bound_iam_principal_id (hashicorp#3213) changelog++ Add option to set cluster TLS cipher suites. (hashicorp#3228)
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. |
The following snippet causes the ana aws_instance to be created on every terraform apply.
Output of terraform plan:
The text was updated successfully, but these errors were encountered: