Add test
This commit is contained in:
parent
a808ea3293
commit
66a10d76c3
|
@ -65,6 +65,7 @@ The shielded Folfer blueprint assumes [groups described](#groups) are created in
|
|||
There are three sets of variables you will need to fill in:
|
||||
```
|
||||
organization = {
|
||||
id = "12345678"
|
||||
domain = "example.com"
|
||||
}
|
||||
prefix = "prefix"
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
# tfdoc:file:description Folder resources.
|
||||
|
||||
locals {
|
||||
_vpc_sc_vpc_accessible_services = yamldecode(
|
||||
_vpc_sc_vpc_accessible_services = var.data_dir != null ? yamldecode(
|
||||
file("${var.data_dir}/vpc-sc/restricted-services.yaml")
|
||||
)
|
||||
_vpc_sc_restricted_services = yamldecode(
|
||||
) : null
|
||||
_vpc_sc_restricted_services = var.data_dir != null ? yamldecode(
|
||||
file("${var.data_dir}/vpc-sc/restricted-services.yaml")
|
||||
)
|
||||
) : null
|
||||
|
||||
access_policy_create = var.access_policy == null ? {
|
||||
parent = "organizations/${var.organization.id}"
|
||||
|
@ -63,12 +63,12 @@ module "folder" {
|
|||
name = try(var.folder_create.display_name, null)
|
||||
id = var.folder_create != null ? null : var.folder_id
|
||||
group_iam = local.group_iam
|
||||
org_policies_data_path = "${var.data_dir}/org-policies"
|
||||
firewall_policy_factory = {
|
||||
org_policies_data_path = var.data_dir != null ? "${var.data_dir}/org-policies" : null
|
||||
firewall_policy_factory = var.data_dir != null ? {
|
||||
cidr_file = "${var.data_dir}/firewall-policies/cidrs.yaml"
|
||||
policy_name = "${var.prefix}-fw-policy"
|
||||
rules_file = "${var.data_dir}/firewall-policies/hierarchical-policy-rules.yaml"
|
||||
}
|
||||
} : null
|
||||
logging_sinks = var.enable_features.log_sink ? {
|
||||
for name, attrs in var.log_sinks : name => {
|
||||
bq_partitioned_table = attrs.type == "bigquery"
|
||||
|
|
|
@ -43,7 +43,7 @@ variable "enable_features" {
|
|||
log_sink = bool
|
||||
})
|
||||
default = {
|
||||
kms = true
|
||||
kms = false
|
||||
log_sink = true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
# Copyright 2022 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.
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* Copyright 2022 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.
|
||||
*/
|
||||
|
||||
module "test" {
|
||||
source = "../../../../../blueprints/data-solutions/shielded-folder/"
|
||||
data_dir = null
|
||||
folder_create = {
|
||||
display_name = "ShieldedMVP"
|
||||
parent = "organizations/1054601055974"
|
||||
}
|
||||
organization = {
|
||||
domain = "example.com"
|
||||
id = "1122334455"
|
||||
}
|
||||
prefix = "prefix"
|
||||
projects_create = {
|
||||
billing_account_id = "123456-123456-123456"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
# Copyright 2022 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.
|
||||
|
||||
def test_resources(e2e_plan_runner):
|
||||
"Test that plan works and the numbers of resources is as expected."
|
||||
modules, resources = e2e_plan_runner()
|
||||
assert len(modules) == 5
|
||||
assert len(resources) == 18
|
Loading…
Reference in New Issue