Fix CFv2 tests
This commit is contained in:
parent
1d76bfc3ff
commit
01904c3397
|
@ -40,7 +40,7 @@ module "cf-http" {
|
||||||
path = "assets/sample-function/"
|
path = "assets/sample-function/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# tftest modules=1 resources=2 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
|
### PubSub and non-HTTP triggers
|
||||||
|
@ -74,7 +74,7 @@ module "cf-http" {
|
||||||
service_account_email = module.trigger-service-account.email
|
service_account_email = module.trigger-service-account.email
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# tftest modules=2 resources=4 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`
|
Ensure that pubsub service identity (`service-[project number]@gcp-sa-pubsub.iam.gserviceaccount.com` has `roles/iam.serviceAccountTokenCreator`
|
||||||
|
@ -98,7 +98,7 @@ module "cf-http" {
|
||||||
"roles/run.invoker" = ["allUsers"]
|
"roles/run.invoker" = ["allUsers"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# tftest modules=1 resources=3 fixtures=fixtures/functions-default-sa-iam-grants.tf inventory=iam.yaml e2e
|
# tftest modules=1 resources=6 fixtures=fixtures/functions-default-sa-iam-grants.tf inventory=iam.yaml e2e
|
||||||
```
|
```
|
||||||
|
|
||||||
### GCS bucket creation
|
### GCS bucket creation
|
||||||
|
@ -121,7 +121,7 @@ module "cf-http" {
|
||||||
path = "assets/sample-function/"
|
path = "assets/sample-function/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# tftest modules=1 resources=3 fixtures=fixtures/functions-default-sa-iam-grants.tf inventory=bucket-creation.yaml e2e
|
# tftest modules=1 resources=6 fixtures=fixtures/functions-default-sa-iam-grants.tf inventory=bucket-creation.yaml e2e
|
||||||
```
|
```
|
||||||
|
|
||||||
### Service account management
|
### Service account management
|
||||||
|
@ -140,7 +140,7 @@ module "cf-http" {
|
||||||
}
|
}
|
||||||
service_account_create = true
|
service_account_create = true
|
||||||
}
|
}
|
||||||
# tftest modules=1 resources=3 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).
|
To use an externally managed service account, pass its email in `service_account` and leave `service_account_create` to `false` (the default).
|
||||||
|
@ -157,7 +157,7 @@ module "cf-http" {
|
||||||
}
|
}
|
||||||
service_account = var.service_account.email
|
service_account = var.service_account.email
|
||||||
}
|
}
|
||||||
# tftest modules=1 resources=2 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
|
### Custom bundle config
|
||||||
|
@ -185,7 +185,7 @@ module "cf-http" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# tftest modules=1 resources=2 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
|
### Private Cloud Build Pool
|
||||||
|
@ -204,7 +204,7 @@ module "cf-http" {
|
||||||
path = "assets/sample-function/"
|
path = "assets/sample-function/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# tftest modules=1 resources=2 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
|
### Multiple Cloud Functions within project
|
||||||
|
@ -233,7 +233,7 @@ module "cf-http-two" {
|
||||||
path = "assets/sample-function/"
|
path = "assets/sample-function/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# tftest modules=2 resources=4 fixtures=fixtures/functions-default-sa-iam-grants.tf inventory=multiple_functions.yaml e2e
|
# tftest modules=2 resources=7 fixtures=fixtures/functions-default-sa-iam-grants.tf inventory=multiple_functions.yaml e2e
|
||||||
```
|
```
|
||||||
|
|
||||||
### Mounting secrets from Secret Manager
|
### Mounting secrets from Secret Manager
|
||||||
|
@ -272,7 +272,7 @@ module "cf-http" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# tftest modules=1 resources=2 fixtures=fixtures/secret-credentials.tf,fixtures/functions-default-sa-iam-grants.tf inventory=secrets.yaml e2e
|
# tftest modules=2 resources=8 fixtures=fixtures/secret-credentials.tf,fixtures/functions-default-sa-iam-grants.tf inventory=secrets.yaml e2e
|
||||||
```
|
```
|
||||||
<!-- BEGIN TFDOC -->
|
<!-- BEGIN TFDOC -->
|
||||||
## Variables
|
## Variables
|
||||||
|
|
|
@ -17,17 +17,17 @@ values:
|
||||||
build_config:
|
build_config:
|
||||||
- source:
|
- source:
|
||||||
- storage_source:
|
- storage_source:
|
||||||
- bucket: my-prefix-test-cf-bundles
|
- bucket: test-bucket
|
||||||
name: my-prefix-test-cf-http
|
name: test-test-cf-http
|
||||||
project: my-project
|
project: project-id
|
||||||
module.cf-http.google_storage_bucket.bucket[0]:
|
module.cf-http.google_storage_bucket.bucket[0]:
|
||||||
lifecycle_rule:
|
lifecycle_rule:
|
||||||
- action:
|
- action:
|
||||||
- type: Delete
|
- type: Delete
|
||||||
condition:
|
condition:
|
||||||
- age: 1
|
- age: 1
|
||||||
name: my-prefix-test-cf-bundles
|
name: test-bucket
|
||||||
project: my-project
|
project: project-id
|
||||||
versioning:
|
versioning:
|
||||||
- enabled: true
|
- enabled: true
|
||||||
|
|
||||||
|
@ -36,6 +36,6 @@ counts:
|
||||||
google_storage_bucket: 1
|
google_storage_bucket: 1
|
||||||
google_storage_bucket_object: 1
|
google_storage_bucket_object: 1
|
||||||
modules: 1
|
modules: 1
|
||||||
resources: 3
|
resources: 6
|
||||||
|
|
||||||
outputs: {}
|
outputs: {}
|
|
@ -18,22 +18,20 @@ values:
|
||||||
location: europe-west8
|
location: europe-west8
|
||||||
members:
|
members:
|
||||||
- allUsers
|
- allUsers
|
||||||
project: my-project
|
project: project-id
|
||||||
role: roles/run.invoker
|
role: roles/run.invoker
|
||||||
service: test-cf-http
|
service: test-cf-http
|
||||||
module.cf-http.google_cloudfunctions2_function.function: {}
|
module.cf-http.google_cloudfunctions2_function.function: {}
|
||||||
module.cf-http.google_storage_bucket_object.bundle[0]:
|
module.cf-http.google_storage_bucket_object.bundle[0]:
|
||||||
bucket: test-cf-bundles
|
bucket: bucket
|
||||||
customer_encryption: []
|
customer_encryption: []
|
||||||
detect_md5hash: different hash
|
detect_md5hash: different hash
|
||||||
name: bundle-6f1ece136848fee658e335b05fe2d79d.zip
|
name: bundle-95c1b0e5b92dae8333539b1e0ad5173b.zip
|
||||||
source: /tmp/bundle-my-project-test-cf-http.zip
|
source: /tmp/bundle-project-id-test-cf-http.zip
|
||||||
|
|
||||||
counts:
|
counts:
|
||||||
google_cloud_run_service_iam_binding: 1
|
google_cloud_run_service_iam_binding: 1
|
||||||
google_cloudfunctions2_function: 1
|
google_cloudfunctions2_function: 1
|
||||||
google_storage_bucket_object: 1
|
google_storage_bucket_object: 1
|
||||||
modules: 1
|
modules: 1
|
||||||
resources: 3
|
resources: 6
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,12 +14,12 @@
|
||||||
|
|
||||||
values:
|
values:
|
||||||
module.cf-http-one.google_storage_bucket_object.bundle[0]:
|
module.cf-http-one.google_storage_bucket_object.bundle[0]:
|
||||||
source: /tmp/bundle-my-project-test-cf-http-one.zip
|
source: /tmp/bundle-project-id-test-cf-http-one.zip
|
||||||
module.cf-http-two.google_storage_bucket_object.bundle[0]:
|
module.cf-http-two.google_storage_bucket_object.bundle[0]:
|
||||||
source: /tmp/bundle-my-project-test-cf-http-two.zip
|
source: /tmp/bundle-project-id-test-cf-http-two.zip
|
||||||
|
|
||||||
counts:
|
counts:
|
||||||
google_cloudfunctions2_function: 2
|
google_cloudfunctions2_function: 2
|
||||||
google_storage_bucket_object: 2
|
google_storage_bucket_object: 2
|
||||||
modules: 2
|
modules: 2
|
||||||
resources: 4
|
resources: 7
|
||||||
|
|
|
@ -18,24 +18,18 @@ values:
|
||||||
service_config:
|
service_config:
|
||||||
- secret_environment_variables:
|
- secret_environment_variables:
|
||||||
- key: VARIABLE_SECRET
|
- key: VARIABLE_SECRET
|
||||||
project_id: '1234567890'
|
project_id: project-id
|
||||||
secret: var_secret
|
# secret: var_secret # known after apply
|
||||||
version: latest
|
version: latest
|
||||||
secret_volumes:
|
secret_volumes:
|
||||||
- mount_path: /app/secret
|
- mount_path: /app/secret
|
||||||
project_id: '1234567890'
|
project_id: project-id
|
||||||
secret: path_secret
|
# secret: var_secret # known after apply
|
||||||
versions:
|
versions:
|
||||||
- path: first
|
- {}
|
||||||
version: '1'
|
|
||||||
- path: second
|
|
||||||
version: '2'
|
|
||||||
- path: latest
|
|
||||||
version: latest
|
|
||||||
|
|
||||||
counts:
|
counts:
|
||||||
google_cloudfunctions2_function: 1
|
google_cloudfunctions2_function: 1
|
||||||
google_storage_bucket_object: 1
|
google_storage_bucket_object: 1
|
||||||
modules: 1
|
modules: 2
|
||||||
resources: 2
|
resources: 8
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue