-
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
aws_instance security_groups getting only default when using -target=
that points to a module security group
#1858
Comments
Terraform v0.4.2 was used. |
👋 hi @stephenchu 😀 Thanks for the solid bug report. It's so nice to get well written issues. 🙇 Good news! This should be fixed in 0.5.0 which is coming out very shortly. If you'd like to test master in the meantime you are welcome to. I'm going to be optimistic and close this for now, but feel free to reopen if master (or 0.5.0 once its out) gives you trouble. |
It looks like you aren't off the hook yet @phinze 👊 This is from a
Notice the I am still not getting a |
Thanks for testing master! Reopening and we'll take a look. |
Ah I see it now. This is just something we need to detect and error message on. When you say:
I believe you're attempting to access the So what you'll want to do is add to your module something like:
And then reference that value from the top level like this:
Let me know if that makes sense! |
Ops. Paste error. I actually do have the following module output:
|
Oh but I do see your |
Oh with the output that may still be a problem. I'll spin up a test over here too. |
Bingo - reproduced. Definitely a targeting bug. I'll dig in and get back to you. |
@stephenchu FYI as a workaround you can tack on as many |
Yea, I think I tried that trick already with 0.4.2, but it didn't do it for me. I didn't get a chance to try it with today's 0.5.0 yet but I will and report back. Thanks for keeping me updated! Also, 0.5.0 looks like an awesome release! |
Confirmed that having multiple
On a side note: I did have to fix my |
Thanks for following up - that's helpful data. I'll get this looked at soon! |
Allows target dependencies to be properly calculated across module boundaries, fixing scenarios where a target depends on something inside a module, but the contents of the module are not included in the targeted resources. fixes #1858
🙇 |
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. |
It seems my
aws_instance
.security_groups
value cannot contain (or mix with) a modularizedaws_security_group
resource and a locally definedaws_security_group
resource.Suppose I have the following folder structure:
... and the following files:
Then, when I apply with
terraform apply -input=false
, thebuggy
instance will correctly be associated with the new security groups "consul_dns" and "ssh".However, when I apply with
terraform apply -input=false -target=aws_instance.buggy
, which I assume the implicit dependencies will also create and associate it with "consul_dns" and "ssh", Terraform will only create "consul_dns" (but not "ssh"), and fails to associate "consul_dns" to mybuggy
instance; it just associates thedefault
security group tobuggy
.If I also added
-target=aws_security_group.ssh
, then Terraform will create but not associate it.Is this expected? Ultimately I want to create
buggy
(through use of-target=
) and have both security groups associated, despite one defined as a module and one elsewhere.Thanks.
The text was updated successfully, but these errors were encountered: