Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to 5.0.0 breaks pubsub #16129

Closed
dogmatic69 opened this issue Oct 5, 2023 · 10 comments
Closed

Upgrade to 5.0.0 breaks pubsub #16129

dogmatic69 opened this issue Oct 5, 2023 · 10 comments
Assignees
Labels
bug forward/review In review; remove label to forward service/pubsub

Comments

@dogmatic69
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

Affected Resource(s)

  • google_pubsub_topic

Terraform Configuration Files

resource "google_pubsub_topic" "topic" {
  name = join("-", compact([var.name, var.seed]))

  project                    = var.project
  message_retention_duration = var.retention_duration

  labels = {
    terraformed = "true"
    component   = var.component
    seed        = var.seed
  }

  dynamic "message_storage_policy" {
    for_each = var.allowed_regions != null ? ["yes"] : []

    content {
      allowed_persistence_regions = var.allowed_regions
    }
  }
}

Debug Output

Error: Error updating Topic "projects/xxx/topics/yyy": googleapi: Error 400: The update_mask in the UpdateTopicRequest must be set, and must contain a non-empty paths list.

  with module.foo.google_pubsub_topic.topic,
  on .terraform/modules/foo/modules/async-messaging/topic/resources.tf line 1, in resource "google_pubsub_topic" "topic":
   1: resource "google_pubsub_topic" "topic" {

The plan is as follows with many similar errors / updates to the topic. For reference the value of "seed" is "" (empty string) and has not changed but is passed in as a variable.

  # module.foo.google_pubsub_topic.topic will be updated in-place
  ~ resource "google_pubsub_topic" "topic" {
        id               = "projects/xxx/topics/yyy"
        name             = "yyy"
      ~ terraform_labels = {
          + "seed"        = (known after apply)
            # (2 unchanged elements hidden)
        }
        # (3 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Plan: 1 to add, 55 to change, 0 to destroy.

Panic Output

Expected Behavior

it should update the resource as was the case in 4.x

Actual Behavior

apply fails with the stated error

Steps to Reproduce

Create simple topic in 4.x, provision, update to 5.x and try again

  1. terraform apply

Important Factoids

References

  • #0000
@dogmatic69 dogmatic69 added the bug label Oct 5, 2023
@github-actions github-actions bot added forward/review In review; remove label to forward service/pubsub labels Oct 5, 2023
@edwardmedia edwardmedia self-assigned this Oct 5, 2023
@edwardmedia
Copy link
Contributor

edwardmedia commented Oct 5, 2023

I can repro the issue with blow config

resource "google_pubsub_topic" "example" {
  name = "example-topic"

  message_storage_policy {
    allowed_persistence_regions = [
      "europe-west3",
    ]
  }

  labels = {
    terraformed = "true"
    component   = "component"
    seed        = "seed"
  }
}

terraform {
    required_providers {
        google = {
            version = "~> 5.0.0"
            #version = "~> 4.84.0"
            #version = "~> 4.80.0"
        }
            google-beta = {
            version = "~> 5.0.0"
            #version = "~> 4.84.0"
            #version = "~> 4.80.0"
        }
    }
}

@c2thorn
Copy link
Collaborator

c2thorn commented Oct 5, 2023

The error looks to be the same as #16091, is this a duplicate?

@edwardmedia
Copy link
Contributor

@c2thorn the error does look like the same as reported #16091

@edwardmedia
Copy link
Contributor

Local test run with the latest source code passed.

@edwardmedia
Copy link
Contributor

close as dup of #16091

@dogmatic69
Copy link
Author

Local test run with the latest source code passed.

The issue is moving from 4.x to 5.x? Does the local test run cover that situation?

When will the apparent fixes be released?

@c2thorn
Copy link
Collaborator

c2thorn commented Oct 5, 2023

@dogmatic69 Yes it is an issue with existing resources upgrading from 4.x to 5.0. I assume by local test @edwardmedia meant manually testing the upgrade with the latest source code on main (with the fix)

When will the apparent fixes be released?

Target is Monday October 9th with v5.1.0

@dogmatic69
Copy link
Author

I've tried the workaround and seem to be working again.

Make some other change- such as adding a new label or modifying the existing one to avoid making a spurious call

@dogmatic69
Copy link
Author

Seems like once the new tags are applied, the next apply with no changes breaks again. So the workaround only works once.

Copy link

github-actions bot commented Nov 9, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug forward/review In review; remove label to forward service/pubsub
Projects
None yet
Development

No branches or pull requests

3 participants