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

feat(TPG>=5.31)!: add cloud storage filename datetime format support #192

Merged
merged 4 commits into from
Jun 28, 2024

Conversation

lahuang4
Copy link
Contributor

@lahuang4 lahuang4 commented May 29, 2024

I've tried to add support for this new field following GoogleCloudPlatform/magic-modules#10713. However, I'm having some trouble with having the example in examples/cloud_storage pick up the new filename_datetime_format field (it seems to be ignored).

With the updated example which attempts to set filename_prefix, filename_suffix, and filename_datetime_format, I get this with terraform plan:

terraform-google-pubsub/examples/cloud_storage$ terraform init -upgrade

Initializing the backend...
Upgrading modules...
Downloading registry.terraform.io/terraform-google-modules/pubsub/google 6.0.0 for pubsub...
- pubsub in .terraform/modules/pubsub

Initializing provider plugins...
- Finding hashicorp/google versions matching ">= 4.78.0, < 6.0.0"...
- Finding latest version of hashicorp/random...
- Using previously-installed hashicorp/google v5.31.1
- Using previously-installed hashicorp/random v3.6.2

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.



terraform-google-pubsub/examples/cloud_storage$ terraform plan
var.project_id
  The project ID to manage the Pub/Sub resources

  Enter a value: <project>

...

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # module.pubsub.google_pubsub_subscription.cloud_storage_subscriptions["example_bucket_subscription"] will be created
  + resource "google_pubsub_subscription" "cloud_storage_subscriptions" {
      + ack_deadline_seconds       = 300
      + effective_labels           = (known after apply)
      + id                         = (known after apply)
      + message_retention_duration = "604800s"
      + name                       = "example_bucket_subscription"
      + project                    = "<project>"
      + terraform_labels           = (known after apply)
      + topic                      = "cft-tf-pubsub-topic-cloud-storage"

      + cloud_storage_config {
          + bucket          = "test_bucket-ed5de96a"
          + filename_prefix = "example_prefix_"
          + filename_suffix = "_example_suffix"
          + max_duration    = "300s"
          + state           = (known after apply)
        }
    }

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

─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions if you run "terraform apply" now.

I suspect that the issue might be because the example seems to be stubbornly requiring a version >= 4.78 even though I've changed the versions files to require version >= 5.31.

Would appreciate any insight you might have (maybe I implemented the provider incorrectly, but I'm surprised that it passes the tests in that repo if that's the case).

@lahuang4 lahuang4 requested review from imrannayer and a team as code owners May 29, 2024 21:22
@lahuang4
Copy link
Contributor Author

A friendly bump on this, Imran :)

@imrannayer
Copy link
Collaborator

@lahuang4 can u plz add a doc in [doc folder] detailing breaking change?

@imrannayer
Copy link
Collaborator

/gcbrun

@lahuang4
Copy link
Contributor Author

@lahuang4 can u plz add a doc in [doc folder] detailing breaking change?

Should this look something like https://github.com/terraform-google-modules/terraform-google-pubsub/blob/master/docs/upgrading_to_v2.0.md? I'm not sure what version number will be released next (I'd guess v7.0?).

I thought that the breaking change would automatically be included in the version's release notes, similar to the breaking changes listed in https://github.com/terraform-google-modules/terraform-google-pubsub/releases/tag/v6.0.0 -- do I still need to add a doc?

Thanks!

@imrannayer
Copy link
Collaborator

@lahuang4 yes breaking change will be in change. Next version will be 7.0. You can create upgrade docs.

@imrannayer
Copy link
Collaborator

/gcbrun

@imrannayer imrannayer self-assigned this Jun 28, 2024
@imrannayer imrannayer merged commit 46a264b into terraform-google-modules:master Jun 28, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants