Skip to content
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

Add consul_config_entry datasource #318

Merged
merged 3 commits into from
Dec 13, 2022

Conversation

remilapeyre
Copy link
Collaborator

I'm not updating the docs in this pull request as I will switch the
whole provider to use terraform-plugin-docs in
#309. I will
update the documentation after merging this PR.

Closes #317

I'm not updating the docs in this pull request as I will switch the
whole provider to use terraform-plugin-docs in
hashicorp#309. I will
update the documentation after merging this PR.

Closes hashicorp#317
Copy link
Contributor

@dhiaayachi dhiaayachi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @remilapeyre
I have a question about the config entry id uniqueness in here.

return err
}

d.SetId(fmt.Sprintf("%s/%s", kind, name))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't id collide with other config entries with the same kind/name in other partitions/namespaces?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id in Terraform resources or datasources is often unique but does not need to, when objects don't have a specific ID it can happen that they have the same of another.

For example Consul has this at https://github.com/hashicorp/terraform-provider-consul/blob/master/consul/resource_consul_keys.go#L188-L191 where all consul_keys resources will have the same id no matter the keys being set and another occurence of this in the Vault provider is at https://github.com/hashicorp/terraform-provider-vault/blob/main/vault/resource_generic_endpoint.go#L111 where multiple vault_generic_endpoint resources can have the same id despite being in different namespace.

Here because config entries do not have IDs and the user won't use it it does not matter what placeholder we use.

Copy link
Contributor

@dhiaayachi dhiaayachi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@remilapeyre remilapeyre merged commit 5bf225e into hashicorp:master Dec 13, 2022
@remilapeyre remilapeyre deleted the remilapeyre/issue317 branch December 13, 2022 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Add data lookup for consul_config resources
2 participants