hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.34k stars 1.74k forks source link

google_network_security_url_lists name change bug #19718

Open syubuntu opened 1 month ago

syubuntu commented 1 month ago

Community Note

Terraform Version & Provider Version(s)

Terraform v1.9.5 on linux_amd64

Affected Resource(s)

google_network_security_url_lists

Terraform Configuration

before change code:

resource "google_network_security_url_lists" "default" {
  name     = "my-url-lists"
  location = "us-central1"
  values   = ["www.example.com"]
}

note: This code is same as basic example of below.
https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/network_security_url_lists#example-usage---network-security-url-lists-basic

after change code:

resource "google_network_security_url_lists" "default" {
  name     = "my-url-lists-renamed"
  location = "us-central1"
  values   = ["www.example.com"]
}

Debug Output

No response

Expected Behavior

forces replacements happens because UrlList name is immutable.

Actual Behavior

The below error occurs. No change happens to "my-url-lists".

│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to google_network_security_url_lists.default, provider
│ "provider[\"registry.terraform.io/hashicorp/google\"]" produced an unexpected new value: Root object was present, but now
│ absent.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Steps to reproduce

  1. terraform apply with before change code.
  2. change the code to after change code.
  3. terraform apply with after change code.

Important Factoids

No response

References

No response

b/372044327

ggtisc commented 1 month ago

This looks like incorrect behavior. In my case I tried to reproduce the issue. Although I didn't get an error, a new resource was created without deleting the existing one which is also not something to expect. I'm forwarding it for a more in-depth review