-
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
source_dest_check broken in 0.3.7 #1020
Comments
Output of a run, with TF_LOG=1 set:
|
Screenshot of the test server's state after bringing it up: |
You're right, I can already see the problem. |
xoxo @teancom for creating this ticket |
Odd, I thought that #1003 would have fixed this. Did I mess it up somehow? |
Ah I see it now. It was only ever supported in Fixing now... |
The `SourceDestCheck` attribute can only be changed via `ModifyInstance`, so the AWS instance resource's `Create` function calls out to `Update` before it returns to take care of applying `source_dest_check` properly. The `Update` function originally guarded against unnecessary API calls with `GetOk`, which worked fine until #993 when we changed the `GetOk` semantics to no longer distinguish between "configured and zero-value" and "not configured". I attempted in #1003 to fix this by switching to `HasChange` for the guard, but this does not work in the `Create` case. I played around with a few different ideas, none of which worked: (a) Setting `Default: true` on `source_dest_check' has no effect (b) Setting `Computed: true` on `source_dest_check' and adding a `d.Set` call in the `Read` function (which will initially set the value to `true` after instance creation). I really thought I could get this to work, but it results in the following: ```go d.Get('source_dest_check') // true d.HasChange('source_dest_check') // false d.GetChange('source_dest_check') // old: false, new: false ``` I couldn't figure out a way of coherently dealing with that result, so I ended up throwing up my hands and giving up on the guard altogether. We'll call `ModifyInstance` more than we have to, but this at least yields expected behavior for both Creates and Updates. Fixes #1020
Sweet. On Sat, Feb 21, 2015 at 11:33 AM, Paul Hinze notifications@github.com
|
source_dest_check seems to be broken again in master. |
@james-masson I cannot confirm that, just built a fresh binary from 16cafe9 having following: resource "aws_instance" "nat" {
...
source_dest_check = false
} and everything went ok. |
The `SourceDestCheck` attribute can only be changed via `ModifyInstance`, so the AWS instance resource's `Create` function calls out to `Update` before it returns to take care of applying `source_dest_check` properly. The `Update` function originally guarded against unnecessary API calls with `GetOk`, which worked fine until hashicorp#993 when we changed the `GetOk` semantics to no longer distinguish between "configured and zero-value" and "not configured". I attempted in hashicorp#1003 to fix this by switching to `HasChange` for the guard, but this does not work in the `Create` case. I played around with a few different ideas, none of which worked: (a) Setting `Default: true` on `source_dest_check' has no effect (b) Setting `Computed: true` on `source_dest_check' and adding a `d.Set` call in the `Read` function (which will initially set the value to `true` after instance creation). I really thought I could get this to work, but it results in the following: ```go d.Get('source_dest_check') // true d.HasChange('source_dest_check') // false d.GetChange('source_dest_check') // old: false, new: false ``` I couldn't figure out a way of coherently dealing with that result, so I ended up throwing up my hands and giving up on the guard altogether. We'll call `ModifyInstance` more than we have to, but this at least yields expected behavior for both Creates and Updates. Fixes hashicorp#1020
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. |
Using terraform to create a
nat
instance in AWS is currently broken, as settingsource_dest_check = false
does not currently actually turn off the source/dest check, and so it cannot route traffic.An example project is at https://github.com/teancom/terraform-test You'll need to replace the security_groups and subnet_id with values that work for you, but it should work out of the box otherwise.
The text was updated successfully, but these errors were encountered: