Fix tests on stages

This commit is contained in:
Simone Ruffilli 2022-02-24 15:05:18 +01:00
parent 36cca5946a
commit dc3a2ad7be
9 changed files with 88 additions and 110 deletions

View File

@ -22,8 +22,8 @@ locals {
_defaults_net = {
billing_account_id = var.billing_account.id
environment_dns_zone = var.environment_dns_zone
shared_vpc_self_link = try(var.shared_vpc_self_links["dev:spoke-0"], null)
vpc_host_project = try(var.vpc_host_project_ids["dev:spoke-0"], null)
shared_vpc_self_link = try(var.shared_vpc_self_links["dev-spoke-0"], null)
vpc_host_project = try(var.vpc_host_project_ids["dev-spoke-0"], null)
}
defaults = merge(local._defaults, local._defaults_net)
projects = {

View File

@ -15,17 +15,30 @@
*/
module "stage" {
source = "../../../../../fast/stages/02-networking-nva"
billing_account_id = "000000-111111-222222"
organization = {
domain = "gcp-pso-italy.net"
id = 856933387836
customer_id = "C01lmug8b"
}
prefix = "fast"
project_factory_sa = {
dev = "foo@iam"
prod = "bar@iam"
}
source = "../../../../../fast/stages/02-networking-nva"
data_dir = "../../../../../fast/stages/02-networking-nva/data/"
billing_account = {
id = "000000-111111-222222"
organization_id = 123456789012
}
custom_roles = {
service_project_network_admin = "organizations/123456789012/roles/foo"
}
folder_ids = {
networking = null
networking-dev = null
networking-prod = null
}
service_accounts = {
data-platform-dev = "string"
data-platform-prod = "string"
project-factory-dev = "string"
project-factory-prod = "string"
}
organization = {
domain = "fast.example.com"
id = 123456789012
customer_id = "C00000000"
}
prefix = "fast2"
}

View File

@ -14,18 +14,47 @@
* limitations under the License.
*/
# module "stage" {
# source = "../../../../../fast/stages/02-networking-vpn"
# billing_account_id = "000000-111111-222222"
# organization = {
# domain = "gcp-pso-italy.net"
# id = 856933387836
# customer_id = "C01lmug8b"
# }
# prefix = "fast"
# project_factory_sa = {
# dev = "foo@iam"
# prod = "bar@iam"
# }
# data_dir = "../../../../../fast/stages/02-networking-vpn/data/"
# }
module "stage" {
source = "../../../../../fast/stages/02-networking-vpn"
billing_account_id = "000000-111111-222222"
organization = {
domain = "gcp-pso-italy.net"
id = 856933387836
customer_id = "C01lmug8b"
}
prefix = "fast"
project_factory_sa = {
dev = "foo@iam"
prod = "bar@iam"
}
source = "../../../../../fast/stages/02-networking-vpn"
data_dir = "../../../../../fast/stages/02-networking-vpn/data/"
billing_account = {
id = "000000-111111-222222"
organization_id = 123456789012
}
custom_roles = {
service_project_network_admin = "organizations/123456789012/roles/foo"
}
folder_ids = {
networking = null
networking-dev = null
networking-prod = null
}
service_accounts = {
data-platform-dev = "string"
data-platform-prod = "string"
project-factory-dev = "string"
project-factory-prod = "string"
}
organization = {
domain = "fast.example.com"
id = 123456789012
customer_id = "C00000000"
}
prefix = "fast2"
}

View File

@ -15,23 +15,20 @@
*/
module "stage" {
source = "../../../../../fast/stages/02-security"
billing_account_id = "000000-111111-222222"
folder_id = "folders/12345678"
source = "../../../../../fast/stages/02-security"
billing_account = {
id = "000000-111111-222222"
organization_id = 123456789012
}
folder_ids = {
security = null
}
organization = {
domain = "gcp-pso-italy.net"
id = 856933387836
customer_id = "C01lmug8b"
}
prefix = "fast"
kms_restricted_admins = {
"dev" : [
"serviceAccount:fast-dev-resman-pf-0@fast-prod-iac-core-0.iam.gserviceaccount.com"
],
"prod" : [
"serviceAccount:fast-prod-resman-pf-0@fast-prod-iac-core-0.iam.gserviceaccount.com"
]
}
kms_keys = {
compute = {
iam = {
@ -42,6 +39,11 @@ module "stage" {
rotation_period = null
}
}
service_accounts = {
security = "foobar@iam.gserviceaccount.com"
project-factory-dev = "foobar@iam.gserviceaccount.com"
project-factory-prod = "foobar@iam.gserviceaccount.com"
}
vpc_sc_ingress_policies = {
iac = {
ingress_from = {

View File

@ -19,10 +19,14 @@ module "projects" {
data_dir = "./data/projects/"
defaults_file = "./data/defaults.yaml"
prefix = "test"
billing_account_id = "12345-67890A-BCDEF0"
environment_dns_zone = "dev"
shared_vpc_self_link = "fake_link"
vpc_host_project = "host_project"
billing_account = {
id = "000000-111111-222222"
organization_id = 123456789012
}
shared_vpc_self_links = {
dev-spoke-0 = "link"
}
}

View File

@ -1,4 +0,0 @@
{
"billing_account_id": "012345-67890A-BCDEF0",
"prefix": "fast"
}

View File

@ -1,5 +0,0 @@
{
"environment_dns_zone": "prod.gcp.example.com.",
"shared_vpc_self_link": "https://www.googleapis.com/compute/v1/projects/fast-example/global/networks/prod-spoke-0",
"vpc_host_project": "fast-example"
}

View File

@ -1,61 +0,0 @@
/**
* 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.
*/
#TODO: tfdoc annotations
variable "billing_account_id" {
# tfdoc:variable:source 00-bootstrap
description = "Billing account id."
type = string
}
variable "data_dir" {
description = "Relative path for the folder storing configuration data."
type = string
default = "data/projects"
}
variable "environment_dns_zone" {
# tfdoc:variable:source 02-networking
description = "DNS zone suffix for environment."
type = string
default = null
}
variable "defaults_file" {
description = "Relative path for the file storing the project factory configuration."
type = string
default = "data/defaults.yaml"
}
#TODO(sruffilli): is this really required?
variable "environment" {
description = "Environment where projects will be created (e.g. prod, dev, ...)."
type = string
default = "prod"
}
variable "shared_vpc_self_link" {
# tfdoc:variable:source 02-networking
description = "Self link for the shared VPC."
type = string
}
variable "vpc_host_project" {
# tfdoc:variable:source 02-networking
description = "Host project for the shared VPC."
type = string
}