Skip to content

Commit

Permalink
fix cloud-functions test
Browse files Browse the repository at this point in the history
  • Loading branch information
wiktorn committed Sep 3, 2024
1 parent d613066 commit 3631f92
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 30 deletions.
24 changes: 12 additions & 12 deletions modules/cloud-function-v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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).
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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}"
]
}
}
Expand Down Expand Up @@ -369,7 +369,7 @@ module "cf-http" {
repository = module.artifact-registry.id
}
}
# tftest modules=4 resources=22
# tftest modules=4 resources=25
```
<!-- BEGIN TFDOC -->
## Variables
Expand Down
20 changes: 10 additions & 10 deletions modules/cloud-function-v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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`
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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).
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
```
<!-- BEGIN TFDOC -->
## Variables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ counts:
google_storage_bucket: 1
google_storage_bucket_object: 1
modules: 1
resources: 7
resources: 6

outputs: {}
2 changes: 1 addition & 1 deletion tests/modules/cloud_function_v1/examples/iam.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ counts:
google_cloudfunctions_function: 1
google_storage_bucket_object: 1
modules: 1
resources: 7
resources: 6
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ counts:
google_cloudfunctions_function: 2
google_storage_bucket_object: 2
modules: 2
resources: 8
resources: 7
2 changes: 1 addition & 1 deletion tests/modules/cloud_function_v1/examples/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ counts:
google_cloudfunctions_function: 1
google_storage_bucket_object: 1
modules: 2
resources: 9
resources: 8
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ counts:
google_storage_bucket: 1
google_storage_bucket_object: 1
modules: 1
resources: 7
resources: 6

outputs: {}
2 changes: 1 addition & 1 deletion tests/modules/cloud_function_v2/examples/iam.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ counts:
google_cloudfunctions2_function: 1
google_storage_bucket_object: 1
modules: 1
resources: 7
resources: 6
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ counts:
google_cloudfunctions2_function: 2
google_storage_bucket_object: 2
modules: 2
resources: 8
resources: 7
2 changes: 1 addition & 1 deletion tests/modules/cloud_function_v2/examples/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ counts:
google_cloudfunctions2_function: 1
google_storage_bucket_object: 1
modules: 2
resources: 9
resources: 8

0 comments on commit 3631f92

Please sign in to comment.