Add support to pause google_cloud_tasks_queue resources
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
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.
Hi @rileykarson, any chance you got some time to take a look at this at your earliest convenience?
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@modular-magician reassign-reviewer
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(+))
Tests analytics
Total tests: 14 Passed tests: 13 Skipped tests: 0 Affected tests: 1
Click here to see the affected service packages
- cloudtasks
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
🔴 Tests failed during RECORDING mode:
TestAccCloudTasksQueue_paused [Error message] [Debug log]
🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.
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(+))
Tests analytics
Total tests: 14 Passed tests: 13 Skipped tests: 0 Affected tests: 1
Click here to see the affected service packages
- cloudtasks
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
🔴 Tests failed during RECORDING mode:
TestAccCloudTasksQueue_paused [Error message] [Debug log]
🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.
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(-))
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
🟢 Tests passed during RECORDING mode:
TestAccCloudTasksQueue_paused [Debug log]
🟢 No issues found for passed tests after REPLAYING rerun.
🟢 All tests passed!
@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.
@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.
@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.
Thanks so much for finishing this one up!