hashicorp / terraform-provider-consul

Terraform Consul provider
https://www.terraform.io/docs/providers/consul/
Mozilla Public License 2.0
125 stars 112 forks source link

Feat: add consul datacenters #293

Closed andyrepton closed 2 years ago

andyrepton commented 2 years ago

This Pull request adds the consul_datacenters data source to the terraform-provider for consul. This is my first Pull Request in Golang, so constructive criticism is welcome! I've added Docs and a test as well.

Thanks!

hashicorp-cla commented 2 years ago

CLA assistant check
All committers have signed the CLA.

andyrepton commented 2 years ago

The force push was me fixing the email address used in the commit

remilapeyre commented 2 years ago

Hi @Seth-Karlo, welcome to Go development and in this repo! Thanks for taking the time to submit this PR, there is nothing to criticise really, I only updated dataSourceConsulDatacentersRead() to use stateWriter that removes some of the boilerplate to write the state (not that it makes much difference here but most of the other resources will use it in the end so I did it for the sake of eventual consistency), and added an additional test.

I had no idea that the API returned this information ready to consume so I had pushed back working on #290 but /v1/catalog/datacenters was there all along. Oops!

Regarding the failing tests in the CI it is because the rest of the tests were not updated for Consul 1.11. This is done in https://github.com/hashicorp/terraform-provider-consul/pull/292 so we can just ignore them here.

andyrepton commented 2 years ago

Thanks very much @remilapeyre !