Use provider datacenter as default when the agent cannot be reached #105
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.
According to the current documentation, the datacenter attribute should
default to the provider configuration and if it is not set to the
datacenter of the agent terraform is connected to:
This is not what the code actually does and the datacenter in the provider
configuration is not used most of the time.
Since changing the plugin behavior to what is actually documented may
break code relying on the current one. To keep backward compatibility,
we can change the documentation to:
and fall back to the provider configuration only when the datacenter of
the agent to which terraform is connected to can not be read (when ACL
is enabled and the token used by terraform does not have permission to
read /agent/self for example).
The change is very noisy as it requires to change the
ConfigureFunc
ofthe provider from
(*consulapi.Client, error)
to(*Config, error)
andupdate all places where was being used.
The interesting change is at https://github.com/terraform-providers/terraform-provider-consul/pull/105/files#diff-7c162fe0d0220927a53a0f1977a47a71R361
Discussion: #57