From 3631f927b88836b3c0117b0354ca320e6bf1cebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wiktor=20Niesiob=C4=99dzki?= Date: Tue, 3 Sep 2024 16:05:43 +0000 Subject: [PATCH] fix cloud-functions test --- modules/cloud-function-v1/README.md | 24 +++++++++---------- modules/cloud-function-v2/README.md | 20 ++++++++-------- .../examples/bucket-creation.yaml | 2 +- .../cloud_function_v1/examples/iam.yaml | 2 +- .../examples/multiple_functions.yaml | 2 +- .../cloud_function_v1/examples/secrets.yaml | 2 +- .../examples/bucket-creation.yaml | 2 +- .../cloud_function_v2/examples/iam.yaml | 2 +- .../examples/multiple_functions.yaml | 2 +- .../cloud_function_v2/examples/secrets.yaml | 2 +- 10 files changed, 30 insertions(+), 30 deletions(-) diff --git a/modules/cloud-function-v1/README.md b/modules/cloud-function-v1/README.md index 93fec6b3e8..b63982e38b 100644 --- a/modules/cloud-function-v1/README.md +++ b/modules/cloud-function-v1/README.md @@ -44,7 +44,7 @@ module "cf-http" { google_project_iam_member.bucket_default_compute_account_grant, ] } -# tftest modules=1 resources=6 fixtures=fixtures/functions-default-sa-iam-grants.tf e2e +# tftest modules=1 resources=5 fixtures=fixtures/functions-default-sa-iam-grants.tf e2e ``` ### PubSub and non-HTTP triggers @@ -70,7 +70,7 @@ module "cf-http" { ] } -# tftest modules=2 resources=8 fixtures=fixtures/pubsub.tf,fixtures/functions-default-sa-iam-grants.tf e2e +# tftest modules=2 resources=7 fixtures=fixtures/pubsub.tf,fixtures/functions-default-sa-iam-grants.tf e2e ``` ### Controlling HTTP access @@ -94,7 +94,7 @@ module "cf-http" { google_project_iam_member.bucket_default_compute_account_grant, ] } -# tftest modules=1 resources=7 fixtures=fixtures/functions-default-sa-iam-grants.tf inventory=iam.yaml e2e +# tftest fixtures=fixtures/functions-default-sa-iam-grants.tf inventory=iam.yaml e2e ``` ### GCS bucket creation @@ -120,7 +120,7 @@ module "cf-http" { google_project_iam_member.bucket_default_compute_account_grant, ] } -# tftest modules=1 resources=7 fixtures=fixtures/functions-default-sa-iam-grants.tf inventory=bucket-creation.yaml e2e +# tftest fixtures=fixtures/functions-default-sa-iam-grants.tf inventory=bucket-creation.yaml e2e ``` ### Service account management @@ -142,7 +142,7 @@ module "cf-http" { google_project_iam_member.bucket_default_compute_account_grant, ] } -# tftest modules=1 resources=7 fixtures=fixtures/functions-default-sa-iam-grants.tf e2e +# tftest modules=1 resources=6 fixtures=fixtures/functions-default-sa-iam-grants.tf e2e ``` To use an externally managed service account, pass its email in `service_account` and leave `service_account_create` to `false` (the default). @@ -162,7 +162,7 @@ module "cf-http" { google_project_iam_member.bucket_default_compute_account_grant, ] } -# tftest modules=1 resources=6 fixtures=fixtures/functions-default-sa-iam-grants.tf e2e +# tftest modules=1 resources=5 fixtures=fixtures/functions-default-sa-iam-grants.tf e2e ``` ### Custom bundle config @@ -193,7 +193,7 @@ module "cf-http" { google_project_iam_member.bucket_default_compute_account_grant, ] } -# tftest modules=1 resources=6 fixtures=fixtures/functions-default-sa-iam-grants.tf e2e +# tftest modules=1 resources=5 fixtures=fixtures/functions-default-sa-iam-grants.tf e2e ``` ### Private Cloud Build Pool @@ -215,7 +215,7 @@ module "cf-http" { google_project_iam_member.bucket_default_compute_account_grant, ] } -# tftest modules=1 resources=7 fixtures=fixtures/cloudbuild-custom-pool.tf,fixtures/functions-default-sa-iam-grants.tf e2e +# tftest modules=1 resources=6 fixtures=fixtures/cloudbuild-custom-pool.tf,fixtures/functions-default-sa-iam-grants.tf e2e ``` ### Multiple Cloud Functions within project @@ -247,7 +247,7 @@ module "cf-http-two" { google_project_iam_member.bucket_default_compute_account_grant, ] } -# tftest modules=2 resources=8 fixtures=fixtures/functions-default-sa-iam-grants.tf inventory=multiple_functions.yaml e2e +# tftest fixtures=fixtures/functions-default-sa-iam-grants.tf inventory=multiple_functions.yaml e2e ``` ### Mounting secrets from Secret Manager @@ -288,7 +288,7 @@ module "cf-http" { google_project_iam_member.bucket_default_compute_account_grant, ] } -# tftest modules=2 resources=9 fixtures=fixtures/secret-credentials.tf,fixtures/functions-default-sa-iam-grants.tf inventory=secrets.yaml e2e +# tftest fixtures=fixtures/secret-credentials.tf,fixtures/functions-default-sa-iam-grants.tf inventory=secrets.yaml e2e ``` ### Using CMEK to encrypt function resources @@ -314,7 +314,7 @@ module "project" { # grant compute default service account that is used by Cloud Founction # permission to read from the buckets so it can function sources "roles/storage.objectViewer" = [ - "serviceAccount:${module.project.default_service_accounts.compute}" + "serviceAccount:${module.project.default_service_accounts.compute}" ] } } @@ -369,7 +369,7 @@ module "cf-http" { repository = module.artifact-registry.id } } -# tftest modules=4 resources=22 +# tftest modules=4 resources=25 ``` ## Variables diff --git a/modules/cloud-function-v2/README.md b/modules/cloud-function-v2/README.md index 86725ffb22..0fc90148ca 100644 --- a/modules/cloud-function-v2/README.md +++ b/modules/cloud-function-v2/README.md @@ -43,7 +43,7 @@ module "cf-http" { google_project_iam_member.bucket_default_compute_account_grant, ] } -# tftest modules=1 resources=6 fixtures=fixtures/functions-default-sa-iam-grants.tf e2e +# tftest modules=1 resources=5 fixtures=fixtures/functions-default-sa-iam-grants.tf e2e ``` ### PubSub and non-HTTP triggers @@ -80,7 +80,7 @@ module "cf-http" { google_project_iam_member.bucket_default_compute_account_grant, ] } -# tftest modules=3 resources=10 fixtures=fixtures/pubsub.tf,fixtures/functions-default-sa-iam-grants.tf e2e +# tftest modules=3 resources=9 fixtures=fixtures/pubsub.tf,fixtures/functions-default-sa-iam-grants.tf e2e ``` Ensure that pubsub service identity (`service-[project number]@gcp-sa-pubsub.iam.gserviceaccount.com` has `roles/iam.serviceAccountTokenCreator` @@ -107,7 +107,7 @@ module "cf-http" { google_project_iam_member.bucket_default_compute_account_grant, ] } -# tftest modules=1 resources=7 fixtures=fixtures/functions-default-sa-iam-grants.tf inventory=iam.yaml e2e +# tftest fixtures=fixtures/functions-default-sa-iam-grants.tf inventory=iam.yaml e2e ``` ### GCS bucket creation @@ -133,7 +133,7 @@ module "cf-http" { google_project_iam_member.bucket_default_compute_account_grant, ] } -# tftest modules=1 resources=7 fixtures=fixtures/functions-default-sa-iam-grants.tf inventory=bucket-creation.yaml e2e +# tftest fixtures=fixtures/functions-default-sa-iam-grants.tf inventory=bucket-creation.yaml e2e ``` ### Service account management @@ -155,7 +155,7 @@ module "cf-http" { google_project_iam_member.bucket_default_compute_account_grant, ] } -# tftest modules=1 resources=7 fixtures=fixtures/functions-default-sa-iam-grants.tf e2e +# tftest modules=1 resources=6 fixtures=fixtures/functions-default-sa-iam-grants.tf e2e ``` To use an externally managed service account, pass its email in `service_account` and leave `service_account_create` to `false` (the default). @@ -175,7 +175,7 @@ module "cf-http" { google_project_iam_member.bucket_default_compute_account_grant, ] } -# tftest modules=1 resources=6 fixtures=fixtures/functions-default-sa-iam-grants.tf e2e +# tftest modules=1 resources=5 fixtures=fixtures/functions-default-sa-iam-grants.tf e2e ``` ### Custom bundle config @@ -206,7 +206,7 @@ module "cf-http" { google_project_iam_member.bucket_default_compute_account_grant, ] } -# tftest modules=1 resources=6 fixtures=fixtures/functions-default-sa-iam-grants.tf e2e +# tftest modules=1 resources=5 fixtures=fixtures/functions-default-sa-iam-grants.tf e2e ``` ### Private Cloud Build Pool @@ -228,7 +228,7 @@ module "cf-http" { google_project_iam_member.bucket_default_compute_account_grant, ] } -# tftest modules=1 resources=7 fixtures=fixtures/functions-default-sa-iam-grants.tf,fixtures/cloudbuild-custom-pool.tf e2e +# tftest modules=1 resources=6 fixtures=fixtures/functions-default-sa-iam-grants.tf,fixtures/cloudbuild-custom-pool.tf e2e ``` ### Multiple Cloud Functions within project @@ -260,7 +260,7 @@ module "cf-http-two" { google_project_iam_member.bucket_default_compute_account_grant, ] } -# tftest modules=2 resources=8 fixtures=fixtures/functions-default-sa-iam-grants.tf inventory=multiple_functions.yaml e2e +# tftest fixtures=fixtures/functions-default-sa-iam-grants.tf inventory=multiple_functions.yaml e2e ``` ### Mounting secrets from Secret Manager @@ -302,7 +302,7 @@ module "cf-http" { ] } -# tftest modules=2 resources=9 fixtures=fixtures/secret-credentials.tf,fixtures/functions-default-sa-iam-grants.tf inventory=secrets.yaml e2e +# tftest fixtures=fixtures/secret-credentials.tf,fixtures/functions-default-sa-iam-grants.tf inventory=secrets.yaml e2e ``` ## Variables diff --git a/tests/modules/cloud_function_v1/examples/bucket-creation.yaml b/tests/modules/cloud_function_v1/examples/bucket-creation.yaml index dc666bd35d..964682337e 100644 --- a/tests/modules/cloud_function_v1/examples/bucket-creation.yaml +++ b/tests/modules/cloud_function_v1/examples/bucket-creation.yaml @@ -31,6 +31,6 @@ counts: google_storage_bucket: 1 google_storage_bucket_object: 1 modules: 1 - resources: 7 + resources: 6 outputs: {} diff --git a/tests/modules/cloud_function_v1/examples/iam.yaml b/tests/modules/cloud_function_v1/examples/iam.yaml index 78f41cb660..8473e6f3d1 100644 --- a/tests/modules/cloud_function_v1/examples/iam.yaml +++ b/tests/modules/cloud_function_v1/examples/iam.yaml @@ -25,4 +25,4 @@ counts: google_cloudfunctions_function: 1 google_storage_bucket_object: 1 modules: 1 - resources: 7 + resources: 6 diff --git a/tests/modules/cloud_function_v1/examples/multiple_functions.yaml b/tests/modules/cloud_function_v1/examples/multiple_functions.yaml index ef34f3ac3c..f550b2c754 100644 --- a/tests/modules/cloud_function_v1/examples/multiple_functions.yaml +++ b/tests/modules/cloud_function_v1/examples/multiple_functions.yaml @@ -22,4 +22,4 @@ counts: google_cloudfunctions_function: 2 google_storage_bucket_object: 2 modules: 2 - resources: 8 + resources: 7 diff --git a/tests/modules/cloud_function_v1/examples/secrets.yaml b/tests/modules/cloud_function_v1/examples/secrets.yaml index 3d42363b0c..dc5d432bd2 100644 --- a/tests/modules/cloud_function_v1/examples/secrets.yaml +++ b/tests/modules/cloud_function_v1/examples/secrets.yaml @@ -31,4 +31,4 @@ counts: google_cloudfunctions_function: 1 google_storage_bucket_object: 1 modules: 2 - resources: 9 + resources: 8 diff --git a/tests/modules/cloud_function_v2/examples/bucket-creation.yaml b/tests/modules/cloud_function_v2/examples/bucket-creation.yaml index fecdbb92e4..99cb104e33 100644 --- a/tests/modules/cloud_function_v2/examples/bucket-creation.yaml +++ b/tests/modules/cloud_function_v2/examples/bucket-creation.yaml @@ -36,6 +36,6 @@ counts: google_storage_bucket: 1 google_storage_bucket_object: 1 modules: 1 - resources: 7 + resources: 6 outputs: {} diff --git a/tests/modules/cloud_function_v2/examples/iam.yaml b/tests/modules/cloud_function_v2/examples/iam.yaml index acd7c1e055..c96dbdb34d 100644 --- a/tests/modules/cloud_function_v2/examples/iam.yaml +++ b/tests/modules/cloud_function_v2/examples/iam.yaml @@ -33,4 +33,4 @@ counts: google_cloudfunctions2_function: 1 google_storage_bucket_object: 1 modules: 1 - resources: 7 + resources: 6 diff --git a/tests/modules/cloud_function_v2/examples/multiple_functions.yaml b/tests/modules/cloud_function_v2/examples/multiple_functions.yaml index 6cf78391b3..65b7a18b9b 100644 --- a/tests/modules/cloud_function_v2/examples/multiple_functions.yaml +++ b/tests/modules/cloud_function_v2/examples/multiple_functions.yaml @@ -22,4 +22,4 @@ counts: google_cloudfunctions2_function: 2 google_storage_bucket_object: 2 modules: 2 - resources: 8 + resources: 7 diff --git a/tests/modules/cloud_function_v2/examples/secrets.yaml b/tests/modules/cloud_function_v2/examples/secrets.yaml index dd637a033f..77a36c8c63 100644 --- a/tests/modules/cloud_function_v2/examples/secrets.yaml +++ b/tests/modules/cloud_function_v2/examples/secrets.yaml @@ -32,4 +32,4 @@ counts: google_cloudfunctions2_function: 1 google_storage_bucket_object: 1 modules: 2 - resources: 9 + resources: 8