provider/google: Fix master_instance_name to prevent slave rebuilds #11477
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 v1beta4 API returns the
master_instance_name
for a Second Generation Replica prefixed with theproject
which is not what Terraform is expecting, nor is it required. With theproject
prefixed Terraform plans to recreate the slave on every subsequent apply. The read method has been adjusted to strip theproject
prefix so slaves can persist.Two minor fixes are included that were uncovered in the acceptance test.
crash_safe_replication
is only relevant for First Generation instances so I have not specified it. With the slave the API returnstrue
even if we haven't set the value. Terraform will attempt to set it tofalse
on the next apply which appears to be a no-op in Google as the next plan will showtrue
. I have changed this to aComputed
value as it is a boolean.Not specifying the optional
start_time
forbackup_configuration
causes subsequent plans to attempt to adjust the Google default to an empty value. As this is a string I have changed the read to return no value if we haven't set the value.