Fixes PermaDiff Issue in google_storage_transfer_job.aws_s3_data_source.aws_access_key
field
#20849
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.
Fixes permadiff issue in
google_storage_transfer_job
resource. Ticket: b/386174536Cause: It appears that the issue is happening because of
GetOkExists
used to obtain value ofaws_s3_data_source.aws_access_key
in the flattener.GetOkExists
checks for the presence of the value regardless of zero value of the field. So here, In this case, we are always getting zero value of the fieldaws_s3_data_source.aws_access_key
which empty list,[]
, and true for it's existence even though it's not specified in the config.Solution: We can use
GetOk
to obtain value of the field from the config.GetOk
treats zero value as absent which is use case here like otherTypeList
field.Alternative: Continue using
GetOkExists
and checking empty vs unset each time,As
GetOkExists
is deprecated, reference, and discouraged to use, I preferGetOk
and didn't see any problem with that as all the nested fields withinaws_access_key
are required. So there won't be a case of empty block(without any nested field specified) and we need to separate from unset nested fields.Testing: Currently
storagetransfer
service lacks acceptance tests for third-party cloud providers so there is no way to add acceptance tests.Derived from GoogleCloudPlatform/magic-modules#12666