Context tests for Cloud Function v1

This commit is contained in:
Wiktor Niesiobędzki
2025-10-20 15:22:26 +00:00
parent d1f257bcb9
commit b67b121a28
3 changed files with 117 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
name = "test-cf-kms"
bucket_name = "bucket"
bundle_config = {
path = "gs://assets/sample-function.zip"
}
context = {
cidr_ranges = {
test = "10.10.20.0/28"
}
custom_roles = {
myrole_one = "organizations/366118655033/roles/myRoleOne"
}
iam_principals = {
mygroup = "group:test-group@example.com"
}
kms_keys = {
test = "projects/foo-prod-sec-core/locations/global/keyRings/prod-global-default/cryptoKeys/compute"
}
locations = {
ew8 = "europe-west8"
}
networks = {
test = "projects/foo-dev-net-spoke-0/global/networks/dev-spoke-0"
}
project_ids = {
test = "foo-test-0"
}
subnets = {
test = "projects/foo-dev-net-spoke-0/regions/europe-west1/subnetworks/gce"
}
}
kms_key = "$kms_keys:test"
iam = {
"$custom_roles:myrole_one" = [
"$iam_principals:mygroup"
]
}
project_id = "$project_ids:test"
region = "$locations:ew8"
service_account_config = {
roles = [
"$custom_roles:myrole_one"
]
}
vpc_connector = {
create = true
name = "connector_name"
}
vpc_connector_config = {
ip_cidr_range = "$cidr_ranges:test"
network = "$networks:test"
instances = {
max = 10
min = 3
}
}

View File

@@ -0,0 +1,60 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
values:
google_cloudfunctions_function.function:
kms_key_name: projects/foo-prod-sec-core/locations/global/keyRings/prod-global-default/cryptoKeys/compute
project: foo-test-0
region: europe-west8
service_account_email: test-cf-kms@foo-test-0.iam.gserviceaccount.com
google_cloudfunctions_function_iam_binding.default["$custom_roles:myrole_one"]:
condition: []
members:
- group:test-group@example.com
project: foo-test-0
region: europe-west8
role: organizations/366118655033/roles/myRoleOne
google_project_iam_member.default["organizations/366118655033/roles/myRoleOne"]:
condition: []
member: serviceAccount:test-cf-kms@foo-test-0.iam.gserviceaccount.com
project: foo-test-0
role: organizations/366118655033/roles/myRoleOne
google_service_account.service_account[0]:
account_id: test-cf-kms
create_ignore_already_exists: null
description: null
disabled: false
display_name: test-cf-kms
email: test-cf-kms@foo-test-0.iam.gserviceaccount.com
member: serviceAccount:test-cf-kms@foo-test-0.iam.gserviceaccount.com
project: foo-test-0
timeouts: null
google_vpc_access_connector.connector[0]:
ip_cidr_range: 10.10.20.0/28
machine_type: e2-micro
max_instances: 10
min_instances: 3
name: connector_name
network: projects/foo-dev-net-spoke-0/global/networks/dev-spoke-0
project: foo-test-0
region: europe-west8
subnet: []
timeouts: null
counts:
google_cloudfunctions_function: 1
google_cloudfunctions_function_iam_binding: 1
google_project_iam_member: 1
google_service_account: 1
google_vpc_access_connector: 1

View File

@@ -14,4 +14,5 @@
module: modules/cloud-function-v1
tests:
context:
kms: