cockroachdb / terraform-provider-cockroach

Terraform provider for CockroachDB Cloud
Apache License 2.0
57 stars 12 forks source link

Unable to modify resources with CRDB Terraform Provider #10

Closed alistair-roacher closed 2 years ago

alistair-roacher commented 2 years ago

Whilst it is possible to successfully create serverless and dedicated clusters, any attempt to modify a cluster returns an error.

Serverless example - attempting to increase the spend from $0 to $5 : ╷ │ Error: Provider produced inconsistent result after apply │ │ When applying changes to cockroach_cluster.cockroach, provider "provider[\"registry.terraform.io/hashicorp/cockroach\"]" produced an unexpected new value: │ .create_spec.serverless.spend_limit: was cty.NumberIntVal(5), but now cty.NumberIntVal(0). │ │ This is a bug in the provider, which should be reported in the provider's own issue tracker. ╵

Dedicated example #1 - attempting to add a 4th node via Terraform dedicated: { region_nodes = { "eu-west-2": 4 }

cockroach_cluster.cockroach: Modifying... [id=8b7dd8da-b654-429f-96a8-bf9fee7cc710] ╷ │ Error: Provider produced inconsistent result after apply │ │ When applying changes to cockroach_cluster.cockroach, provider "provider[\"registry.terraform.io/hashicorp/cockroach\"]" produced an unexpected new value: │ .create_spec.dedicated.region_nodes["eu-west-2"]: was cty.NumberIntVal(4), but now cty.NumberIntVal(3). │ │ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Dedicated example #2 - Attempting to change machine type from "m5.large" to "m5.xlarge" ... ╷ │ Error: Provider produced inconsistent result after apply │ │ When applying changes to cockroach_cluster.cockroach, provider "provider[\"registry.terraform.io/hashicorp/cockroach\"]" produced an unexpected new value: │ .create_spec.dedicated.hardware.machine_spec.machine_type: was cty.StringVal("m5.xlarge"), but now cty.StringVal("m5.large"). │ │ This is a bug in the provider, which should be reported in the provider's own issue tracker. ╵

prafull01 commented 2 years ago

Hi @alistair-roacher Thank you for reporting this. We do support updating the clusters.

Instead of changing the values in create_spec, you have to specify the update_spec with the values we support modifying. For example, in serverless cluster we only support changing spend_limit.

I have added some examples in this PR #13 Please refer the examples mention in the PR and let us know if you face any issues.