Skip to content

Commit

Permalink
chore: add skip_docs flag to Cloud Run TF samples (#6213) (#12274)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Aug 5, 2022
1 parent 39d25c5 commit e92447f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 997 deletions.
2 changes: 2 additions & 0 deletions .changelog/6213.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
```release-note:none
```
125 changes: 0 additions & 125 deletions google/resource_cloud_run_service_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,131 +384,6 @@ resource "google_cloud_run_service" "default" {
`, context)
}

func TestAccCloudRunService_cloudRunServiceScheduledExample(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"project": getTestProjectFromEnv(),
"random_suffix": randString(t, 10),
}

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckCloudRunServiceDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccCloudRunService_cloudRunServiceScheduledExample(context),
},
{
ResourceName: "google_cloud_run_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"name", "location"},
},
},
})
}

func testAccCloudRunService_cloudRunServiceScheduledExample(context map[string]interface{}) string {
return Nprintf(`
resource "google_project_service" "run_api" {
project = "%{project}"
service = "run.googleapis.com"
disable_dependent_services = true
disable_on_destroy = false
}
resource "google_project_service" "iam_api" {
project = "%{project}"
service = "iam.googleapis.com"
disable_on_destroy = false
}
resource "google_project_service" "resource_manager_api" {
project = "%{project}"
service = "cloudresourcemanager.googleapis.com"
disable_on_destroy = false
}
resource "google_project_service" "scheduler_api" {
project = "%{project}"
service = "cloudscheduler.googleapis.com"
disable_on_destroy = false
}
resource "google_cloud_run_service" "default" {
project = "%{project}"
name = "tf-test-my-scheduled-service%{random_suffix}"
location = "us-central1"
template {
spec {
containers {
image = "us-docker.pkg.dev/cloudrun/container/hello"
}
}
}
traffic {
percent = 100
latest_revision = true
}
# Use an explicit depends_on clause to wait until API is enabled
depends_on = [
google_project_service.run_api
]
}
resource "google_service_account" "default" {
project = "%{project}"
account_id = "tf-test-scheduler-sa%{random_suffix}"
description = "Cloud Scheduler service account; used to trigger scheduled Cloud Run jobs."
display_name = "scheduler-sa"
# Use an explicit depends_on clause to wait until API is enabled
depends_on = [
google_project_service.iam_api
]
}
resource "google_cloud_scheduler_job" "default" {
name = "tf-test-scheduled-cloud-run-job%{random_suffix}"
description = "Invoke a Cloud Run container on a schedule."
schedule = "*/8 * * * *"
time_zone = "America/New_York"
attempt_deadline = "320s"
retry_config {
retry_count = 1
}
http_target {
http_method = "POST"
uri = google_cloud_run_service.default.status[0].url
oidc_token {
service_account_email = google_service_account.default.email
}
}
# Use an explicit depends_on clause to wait until API is enabled
depends_on = [
google_project_service.scheduler_api
]
}
resource "google_cloud_run_service_iam_member" "default" {
project = "%{project}"
location = google_cloud_run_service.default.location
service = google_cloud_run_service.default.name
role = "roles/run.invoker"
member = "serviceAccount:${google_service_account.default.email}"
}
`, context)
}

func TestAccCloudRunService_cloudRunServiceSecretEnvironmentVariablesExample(t *testing.T) {
t.Parallel()

Expand Down
Loading

0 comments on commit e92447f

Please sign in to comment.