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.25k stars 1.7k forks source link

Removing schema_settings from google_pubsub_topic does not trigger update #15925

Open GustenT opened 9 months ago

GustenT commented 9 months ago

Community Note

Terraform Version

Terraform v1.4.6
on darwin_arm64
+ provider registry.terraform.io/hashicorp/google v4.83.0

Affected Resource(s)

Terraform Configuration Files

Before

resource "google_pubsub_topic" "topic" {
  project      = google_project.project.project_id
  name         = "topic"

  schema_settings {
    schema   = google_pubsub_schema.schema.id
    encoding = "JSON"
  }

  depends_on = [google_pubsub_schema.schema]
}

resource "google_pubsub_schema" "schema" {
  project    = google_project.project.project_id
  name       = "schema"
  type       = "PROTOCOL_BUFFER"
  definition = "syntax = \"proto3\";\nmessage Results {\nstring message_request = 1;\nstring message_response = 2;\nstring timestamp_request = 3;\nstring timestamp_response = 4;\n}"
}

After

resource "google_pubsub_topic" "topic" {
  project      = google_project.project.project_id
  name         = "topic"

  depends_on = [google_pubsub_schema.schema]
}

resource "google_pubsub_schema" "schema" {
  project    = google_project.project.project_id
  name       = "schema"
  type       = "PROTOCOL_BUFFER"
  definition = "syntax = \"proto3\";\nmessage Results {\nstring message_request = 1;\nstring message_response = 2;\nstring timestamp_request = 3;\nstring timestamp_response = 4;\n}"
}

Expected Behavior

The expected behaviour is that terraform would pick up on the removal of schema_settings and update the topic and remove the schema association from the topic.

Actual Behavior

No changes detected.

Steps to Reproduce

  1. Create a google_pubsub_schema and a google_pubsub_topic with a schema_setting (terraform apply)
  2. Remove schema_setting from google_pubsub_topic resource (terraform apply)

b/301582871

kamalaboulhosn commented 8 months ago

The fix for this would be considered a breaking change. Therefore, it has to wait for next year's 6.0 release.

GustenT commented 8 months ago

That's unfortunate. The bug can be quite damaging if trying to remove a schema and it's setting, resulting in deleting the schema resource and breaking publishing to the topic entirely

kamalaboulhosn commented 6 days ago

The fix has been submitted as part of the next major release, which is planned for August 2024.