scylladb / terraform-provider-scylladbcloud

Terraform provider for ScyllaDB Cloud.
https://registry.terraform.io/providers/scylladb/scylladbcloud/latest
Apache License 2.0
11 stars 10 forks source link

Address nil pointer issues #133

Closed dkropachev closed 7 months ago

dkropachev commented 8 months ago

Closing https://github.com/scylladb/siren/issues/10469

rjeczalik commented 8 months ago

Closing https://github.com/scylladb/siren/issues/10469

I am not sure this PR closes the issue.

We are trading runtime panics (caused by invalid api responses) for runtime errors (introduced here) - and both of them have the same effect - user is not able to use the provider.

Would it be possible to dig deeper what causes those invalid responses that terraform provider is receiving?

dkropachev commented 8 months ago

@rjeczalik , GCP VPC Peering is giving out 0 in region_id all the time, that is why p.RegionByID(vpcPeering.RegionID) returns nil and we have panic here

dkropachev commented 8 months ago

Scenario described in https://github.com/scylladb/siren/issues/10469: Clone this repo https://github.com/ricardoborenstein/1m-ops-demo/tree/gcp

  1. Set the variables required for authentication in variables.tf
  2. terraform init
  3. terraform plan
  4. terraform apply - "yes"
  5. terraform destroy

Endup successfully after this patch:

scylladbcloud_vpc_peering.scylladbcloud: Destroying... [id=scylla-cloud-vpc-297-peering-15e834ad67b5fc07f5a2]
scylladbcloud_vpc_peering.scylladbcloud: Destruction complete after 1s
scylladbcloud_cluster.scylladbcloud: Destroying... [id=297]
scylladbcloud_cluster.scylladbcloud: Destruction complete after 1s

Destroy complete! Resources: 2 destroyed.
rjeczalik commented 7 months ago

Thanks for explaining it to me @dkropachev!