providers/aws: fix source_dest_check on instance creation #1021
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
SourceDestCheck
attribute can only be changed viaModifyInstance
, so the AWS instance resource'sCreate
function callsout to
Update
before it returns to take care of applyingsource_dest_check
properly.The
Update
function originally guarded against unnecessary API callswith
GetOk
, which worked fine until #993 when we changed theGetOk
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 theguard, 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
onsource_dest_check' and adding a
d.Setcall in the
Readfunction (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:
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 leastyields expected behavior for both Creates and Updates.
Fixes #1020