magic-modules icon indicating copy to clipboard operation
magic-modules copied to clipboard

Add support to pause google_cloud_tasks_queue resources

Open liaodaniel opened this issue 6 months ago • 3 comments

Fixes https://github.com/hashicorp/terraform-provider-google/issues/15165.

I mainly looked at https://github.com/GoogleCloudPlatform/magic-modules/pull/8368 for inspiration on adding the functionality. This will be my first time contribution to this repository so will appreciate the feedback. The new field desired_state supports the ability to control the state of the google_cloud_tasks_queue resource. The new field is backwards compatible with the state being set to RUNNING when omitted.

What I have done:

  • Tested locally on terraform-provider-google:

resource creation

# main.tf
provider "google" {
  project     = "project"
  region      = "australia-southeast1"
}

terraform {
  backend "local" {
    path = "terraform.tfstate"
  }
  required_providers {
    google = {
      version = "6.34.1"
    }
  }
}

resource "google_cloud_tasks_queue" "default" {
  name          = "cloud-tasks-queue-test-10"
  location      = "australia-southeast1"
  desired_state = "PAUSED"
}

resource creation apply output:

Terraform will perform the following actions:

  # google_cloud_tasks_queue.default will be created
  + resource "google_cloud_tasks_queue" "default" {
      + desired_state = "PAUSED"
      + id            = (known after apply)
      + location      = "australia-southeast1"
      + name          = "cloud-tasks-queue-test"
      + project       = "project"
      + state         = (known after apply)

      + retry_config (known after apply)
    }

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

google_cloud_tasks_queue.default: Creating...
google_cloud_tasks_queue.default: Creation complete after 1s [id=projects/project/locations/australia-southeast1/queues/cloud-tasks-queue-test]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

resource update:

# main.tf
provider "google" {
  project     = "project"
  region      = "australia-southeast1"
}

terraform {
  backend "local" {
    path = "terraform.tfstate"
  }
  required_providers {
    google = {
      version = "6.34.1"
    }
  }
}

resource "google_cloud_tasks_queue" "default" {
  name          = "cloud-tasks-queue-test-10"
  location      = "australia-southeast1"
  desired_state = "RUNNING"
}

resource creation update output:

Terraform will perform the following actions:

  # google_cloud_tasks_queue.default will be updated in-place
  ~ resource "google_cloud_tasks_queue" "default" {
      ~ desired_state = "PAUSED" -> "RUNNING"
        id            = "projects/project/locations/australia-southeast1/queues/cloud-tasks-queue-test"
        name          = "cloud-tasks-queue-test"
        # (3 unchanged attributes hidden)

      - rate_limits {
          - max_burst_size            = 100 -> null
          - max_concurrent_dispatches = 1000 -> null
          - max_dispatches_per_second = 500 -> null
        }

        # (1 unchanged block hidden)
    }

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

google_cloud_tasks_queue.default: Modifying... [id=projects/project/locations/australia-southeast1/queues/cloud-tasks-queue-test]
google_cloud_tasks_queue.default: Modifications complete after 2s [id=projects/project/locations/australia-southeast1/queues/cloud-tasks-queue-test]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

Release Note Template for Downstream PRs (will be copied)

See Write release notes for guidance.

cloud_tasks: added `desired_state` field to `google_cloud_tasks_queue ` resource

liaodaniel avatar Jun 14 '25 13:06 liaodaniel

Hello! I am a robot. Tests will require approval from a repository maintainer to run.

Googlers: For automatic test runs see go/terraform-auto-test-runs.

@BBBmau, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look.

You can help make sure that review is quick by doing a self-review and by running impacted tests locally.

github-actions[bot] avatar Jun 14 '25 13:06 github-actions[bot]

Hi @rileykarson, any chance you got some time to take a look at this at your earliest convenience?

liaodaniel avatar Jun 18 '25 04:06 liaodaniel

@rileykarson This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

github-actions[bot] avatar Jun 19 '25 09:06 github-actions[bot]

@GoogleCloudPlatform/terraform-team @rileykarson This PR has been waiting for review for 1 week. Please take a look! Use the label disable-review-reminders to disable these notifications.

github-actions[bot] avatar Jun 23 '25 09:06 github-actions[bot]

@GoogleCloudPlatform/terraform-team @rileykarson This PR has been waiting for review for 2 weeks. Please take a look! Use the label disable-review-reminders to disable these notifications.

github-actions[bot] avatar Jun 30 '25 09:06 github-actions[bot]

@GoogleCloudPlatform/terraform-team @rileykarson This PR has been waiting for review for 3 weeks. Please take a look! Use the label disable-review-reminders to disable these notifications.

github-actions[bot] avatar Jul 07 '25 09:07 github-actions[bot]

@GoogleCloudPlatform/terraform-team @rileykarson This PR has been waiting for review for 4 weeks. Please take a look! Use the label disable-review-reminders to disable these notifications.

github-actions[bot] avatar Jul 14 '25 09:07 github-actions[bot]

@GoogleCloudPlatform/terraform-team @rileykarson This PR has been waiting for review for 5 weeks. Please take a look! Use the label disable-review-reminders to disable these notifications.

github-actions[bot] avatar Jul 21 '25 09:07 github-actions[bot]

@GoogleCloudPlatform/terraform-team @rileykarson This PR has been waiting for review for 6 weeks. Please take a look! Use the label disable-review-reminders to disable these notifications.

github-actions[bot] avatar Jul 28 '25 09:07 github-actions[bot]

@modular-magician reassign-reviewer

rileykarson avatar Jul 28 '25 16:07 rileykarson

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 161 insertions(+)) google-beta provider: Diff ( 4 files changed, 161 insertions(+))

modular-magician avatar Jul 28 '25 17:07 modular-magician

Tests analytics

Total tests: 14 Passed tests: 13 Skipped tests: 0 Affected tests: 1

Click here to see the affected service packages
  • cloudtasks
#### Action taken
Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccCloudTasksQueue_paused

Get to know how VCR tests work

modular-magician avatar Jul 28 '25 17:07 modular-magician

🔴 Tests failed during RECORDING mode: TestAccCloudTasksQueue_paused [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

modular-magician avatar Jul 28 '25 17:07 modular-magician

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 166 insertions(+)) google-beta provider: Diff ( 4 files changed, 166 insertions(+))

modular-magician avatar Aug 04 '25 16:08 modular-magician

Tests analytics

Total tests: 14 Passed tests: 13 Skipped tests: 0 Affected tests: 1

Click here to see the affected service packages
  • cloudtasks
#### Action taken
Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccCloudTasksQueue_paused

Get to know how VCR tests work

modular-magician avatar Aug 04 '25 16:08 modular-magician

🔴 Tests failed during RECORDING mode: TestAccCloudTasksQueue_paused [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

modular-magician avatar Aug 04 '25 16:08 modular-magician

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 163 insertions(+), 1 deletion(-)) google-beta provider: Diff ( 4 files changed, 163 insertions(+), 1 deletion(-))

modular-magician avatar Aug 06 '25 18:08 modular-magician

Tests analytics

Total tests: 14 Passed tests: 13 Skipped tests: 0 Affected tests: 1

Click here to see the affected service packages
  • cloudtasks

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccCloudTasksQueue_paused

Get to know how VCR tests work

modular-magician avatar Aug 06 '25 18:08 modular-magician

🟢 Tests passed during RECORDING mode: TestAccCloudTasksQueue_paused [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🟢 All tests passed!

View the build log or the debug log for each test

modular-magician avatar Aug 06 '25 18:08 modular-magician

@BBBmau This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

github-actions[bot] avatar Aug 11 '25 09:08 github-actions[bot]

@GoogleCloudPlatform/terraform-team @BBBmau This PR has been waiting for review for 1 week. Please take a look! Use the label disable-review-reminders to disable these notifications.

github-actions[bot] avatar Aug 13 '25 09:08 github-actions[bot]

@GoogleCloudPlatform/terraform-team @BBBmau This PR has been waiting for review for 2 weeks. Please take a look! Use the label disable-review-reminders to disable these notifications.

github-actions[bot] avatar Aug 20 '25 09:08 github-actions[bot]

Thanks so much for finishing this one up!

wyardley avatar Sep 20 '25 04:09 wyardley