Update hub and spoke peering to optionally create project (#195)
* optionally create project, add vm in hub, export routes to gke peering * fix typo in unrelated module * update README * update README * update unrelated README for lint * fix test
This commit is contained in:
parent
a551fb1224
commit
2ab64446a9
|
@ -62,7 +62,7 @@ Run the `subscription_pull` command until it returns nothing, then run the follo
|
||||||
| project_id | Project id that references existing project. | <code title="">string</code> | ✓ | |
|
| project_id | Project id that references existing project. | <code title="">string</code> | ✓ | |
|
||||||
| *bundle_path* | Path used to write the intermediate Cloud Function code bundle. | <code title="">string</code> | | <code title="">./bundle.zip</code> |
|
| *bundle_path* | Path used to write the intermediate Cloud Function code bundle. | <code title="">string</code> | | <code title="">./bundle.zip</code> |
|
||||||
| *name* | Arbitrary string used to name created resources. | <code title="">string</code> | | <code title="">asset-feed</code> |
|
| *name* | Arbitrary string used to name created resources. | <code title="">string</code> | | <code title="">asset-feed</code> |
|
||||||
| *project_create* | Create project instead ofusing an existing one. | <code title="">bool</code> | | <code title="">false</code> |
|
| *project_create* | Create project instead of using an existing one. | <code title="">bool</code> | | <code title="">false</code> |
|
||||||
| *region* | Compute region used in the example. | <code title="">string</code> | | <code title="">europe-west1</code> |
|
| *region* | Compute region used in the example. | <code title="">string</code> | | <code title="">europe-west1</code> |
|
||||||
|
|
||||||
## Outputs
|
## Outputs
|
||||||
|
|
|
@ -27,7 +27,7 @@ variable "name" {
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "project_create" {
|
variable "project_create" {
|
||||||
description = "Create project instead ofusing an existing one."
|
description = "Create project instead of using an existing one."
|
||||||
type = bool
|
type = bool
|
||||||
default = false
|
default = false
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ gcloud container clusters get-credentials cluster-1 --zone europe-west1-b
|
||||||
kubectl get all
|
kubectl get all
|
||||||
```
|
```
|
||||||
|
|
||||||
The next step is to edit the peering towards the GKE master tenant VPC, and enable export routes. You can do it directly in Terraform with the GKE module `peering_config' variable, via gcloud, or on the cloud ccnsole. We're leaving it as an option, since one of the goals of this example is to allow testing both working and non-working configurations.
|
The example configures the peering with the GKE master VPC to export routes for you, so that VPN routes are passed through the peering. You can diable by hand in the console or by editing the `peering_config' variable in the cluster module, to test non-working configurations or switch to using the [GKE proxy](https://cloud.google.com/solutions/creating-kubernetes-engine-private-clusters-with-net-proxies).
|
||||||
|
|
||||||
### Export routes via Terraform
|
### Export routes via Terraform
|
||||||
|
|
||||||
|
@ -82,15 +82,18 @@ The VPN used to connect the GKE masters VPC does not account for HA, upgrading t
|
||||||
|
|
||||||
| name | description | type | required | default |
|
| name | description | type | required | default |
|
||||||
|---|---|:---: |:---:|:---:|
|
|---|---|:---: |:---:|:---:|
|
||||||
| project_id | Project id for all resources. | <code title="">string</code> | ✓ | |
|
| project_id | Project id used for all resources. | <code title="">string</code> | ✓ | |
|
||||||
| *ip_ranges* | IP CIDR ranges. | <code title="map(string)">map(string)</code> | | <code title="{ hub = "10.0.0.0/24" spoke-1 = "10.0.16.0/24" spoke-2 = "10.0.32.0/24" }">...</code> |
|
| *ip_ranges* | IP CIDR ranges. | <code title="map(string)">map(string)</code> | | <code title="{ hub = "10.0.0.0/24" spoke-1 = "10.0.16.0/24" spoke-2 = "10.0.32.0/24" }">...</code> |
|
||||||
| *ip_secondary_ranges* | Secondary IP CIDR ranges. | <code title="map(string)">map(string)</code> | | <code title="{ spoke-2-pods = "10.128.0.0/18" spoke-2-services = "172.16.0.0/24" }">...</code> |
|
| *ip_secondary_ranges* | Secondary IP CIDR ranges. | <code title="map(string)">map(string)</code> | | <code title="{ spoke-2-pods = "10.128.0.0/18" spoke-2-services = "172.16.0.0/24" }">...</code> |
|
||||||
|
| *prefix* | Arbitrary string used to prefix resource names. | <code title="">string</code> | | <code title="">null</code> |
|
||||||
| *private_service_ranges* | Private service IP CIDR ranges. | <code title="map(string)">map(string)</code> | | <code title="{ spoke-2-cluster-1 = "192.168.0.0/28" }">...</code> |
|
| *private_service_ranges* | Private service IP CIDR ranges. | <code title="map(string)">map(string)</code> | | <code title="{ spoke-2-cluster-1 = "192.168.0.0/28" }">...</code> |
|
||||||
|
| *project_create* | Set to non null if project needs to be created. | <code title="object({ billing_account = string oslogin = bool parent = string })">object({...})</code> | | <code title="null validation { condition = ( var.project_create == null ? true : can(regex("(organizations|folders)/[0-9]+", var.project_create.parent)) ) error_message = "Project parent must be of the form folders/folder_id or organizations/organization_id." }">...</code> |
|
||||||
| *region* | VPC region. | <code title="">string</code> | | <code title="">europe-west1</code> |
|
| *region* | VPC region. | <code title="">string</code> | | <code title="">europe-west1</code> |
|
||||||
|
|
||||||
## Outputs
|
## Outputs
|
||||||
|
|
||||||
| name | description | sensitive |
|
| name | description | sensitive |
|
||||||
|---|---|:---:|
|
|---|---|:---:|
|
||||||
|
| project | Project id. | |
|
||||||
| vms | GCE VMs. | |
|
| vms | GCE VMs. | |
|
||||||
<!-- END TFDOC -->
|
<!-- END TFDOC -->
|
||||||
|
|
|
@ -13,7 +13,9 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
locals {
|
locals {
|
||||||
|
prefix = var.prefix != null && var.prefix != "" ? "${var.prefix}-" : ""
|
||||||
vm-instances = concat(
|
vm-instances = concat(
|
||||||
|
module.vm-hub.instances,
|
||||||
module.vm-spoke-1.instances,
|
module.vm-spoke-1.instances,
|
||||||
module.vm-spoke-2.instances
|
module.vm-spoke-2.instances
|
||||||
)
|
)
|
||||||
|
@ -23,24 +25,54 @@ locals {
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# project #
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
module "project" {
|
||||||
|
source = "../../modules/project"
|
||||||
|
project_create = var.project_create != null
|
||||||
|
billing_account = try(var.project_create.billing_account, null)
|
||||||
|
oslogin = try(var.project_create.oslogin, null)
|
||||||
|
parent = try(var.project_create.parent, null)
|
||||||
|
name = var.project_id
|
||||||
|
services = [
|
||||||
|
"compute.googleapis.com",
|
||||||
|
"container.googleapis.com"
|
||||||
|
]
|
||||||
|
service_config = {
|
||||||
|
disable_on_destroy = false,
|
||||||
|
disable_dependent_services = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Hub networking #
|
# Hub networking #
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
module "vpc-hub" {
|
module "vpc-hub" {
|
||||||
source = "../../modules/net-vpc"
|
source = "../../modules/net-vpc"
|
||||||
project_id = var.project_id
|
project_id = module.project.project_id
|
||||||
name = "hub"
|
name = "${local.prefix}hub"
|
||||||
subnets = [
|
subnets = [
|
||||||
{
|
{
|
||||||
ip_cidr_range = var.ip_ranges.hub
|
ip_cidr_range = var.ip_ranges.hub
|
||||||
name = "hub-default"
|
name = "${local.prefix}hub-1"
|
||||||
region = var.region
|
region = var.region
|
||||||
secondary_ip_range = {}
|
secondary_ip_range = {}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module "nat-hub" {
|
||||||
|
source = "../../modules/net-cloudnat"
|
||||||
|
project_id = module.project.project_id
|
||||||
|
region = var.region
|
||||||
|
name = "${local.prefix}hub"
|
||||||
|
router_name = "${local.prefix}hub"
|
||||||
|
router_network = module.vpc-hub.self_link
|
||||||
|
}
|
||||||
|
|
||||||
module "vpc-hub-firewall" {
|
module "vpc-hub-firewall" {
|
||||||
source = "../../modules/net-vpc-firewall"
|
source = "../../modules/net-vpc-firewall"
|
||||||
project_id = var.project_id
|
project_id = var.project_id
|
||||||
|
@ -55,12 +87,12 @@ module "vpc-hub-firewall" {
|
||||||
|
|
||||||
module "vpc-spoke-1" {
|
module "vpc-spoke-1" {
|
||||||
source = "../../modules/net-vpc"
|
source = "../../modules/net-vpc"
|
||||||
project_id = var.project_id
|
project_id = module.project.project_id
|
||||||
name = "spoke-1"
|
name = "${local.prefix}spoke-1"
|
||||||
subnets = [
|
subnets = [
|
||||||
{
|
{
|
||||||
ip_cidr_range = var.ip_ranges.spoke-1
|
ip_cidr_range = var.ip_ranges.spoke-1
|
||||||
name = "spoke-1-default"
|
name = "${local.prefix}spoke-1-1"
|
||||||
region = var.region
|
region = var.region
|
||||||
secondary_ip_range = {}
|
secondary_ip_range = {}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +101,7 @@ module "vpc-spoke-1" {
|
||||||
|
|
||||||
module "vpc-spoke-1-firewall" {
|
module "vpc-spoke-1-firewall" {
|
||||||
source = "../../modules/net-vpc-firewall"
|
source = "../../modules/net-vpc-firewall"
|
||||||
project_id = var.project_id
|
project_id = module.project.project_id
|
||||||
network = module.vpc-spoke-1.name
|
network = module.vpc-spoke-1.name
|
||||||
admin_ranges_enabled = true
|
admin_ranges_enabled = true
|
||||||
admin_ranges = values(var.ip_ranges)
|
admin_ranges = values(var.ip_ranges)
|
||||||
|
@ -77,10 +109,10 @@ module "vpc-spoke-1-firewall" {
|
||||||
|
|
||||||
module "nat-spoke-1" {
|
module "nat-spoke-1" {
|
||||||
source = "../../modules/net-cloudnat"
|
source = "../../modules/net-cloudnat"
|
||||||
project_id = var.project_id
|
project_id = module.project.project_id
|
||||||
region = var.region
|
region = var.region
|
||||||
name = "spoke-1"
|
name = "${local.prefix}spoke-1"
|
||||||
router_name = "spoke-1"
|
router_name = "${local.prefix}spoke-1"
|
||||||
router_network = module.vpc-spoke-1.self_link
|
router_network = module.vpc-spoke-1.self_link
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,12 +130,12 @@ module "hub-to-spoke-1-peering" {
|
||||||
|
|
||||||
module "vpc-spoke-2" {
|
module "vpc-spoke-2" {
|
||||||
source = "../../modules/net-vpc"
|
source = "../../modules/net-vpc"
|
||||||
project_id = var.project_id
|
project_id = module.project.project_id
|
||||||
name = "spoke-2"
|
name = "${local.prefix}spoke-2"
|
||||||
subnets = [
|
subnets = [
|
||||||
{
|
{
|
||||||
ip_cidr_range = var.ip_ranges.spoke-2
|
ip_cidr_range = var.ip_ranges.spoke-2
|
||||||
name = "spoke-2-default"
|
name = "${local.prefix}spoke-2-1"
|
||||||
region = var.region
|
region = var.region
|
||||||
secondary_ip_range = {
|
secondary_ip_range = {
|
||||||
pods = var.ip_secondary_ranges.spoke-2-pods
|
pods = var.ip_secondary_ranges.spoke-2-pods
|
||||||
|
@ -115,7 +147,7 @@ module "vpc-spoke-2" {
|
||||||
|
|
||||||
module "vpc-spoke-2-firewall" {
|
module "vpc-spoke-2-firewall" {
|
||||||
source = "../../modules/net-vpc-firewall"
|
source = "../../modules/net-vpc-firewall"
|
||||||
project_id = var.project_id
|
project_id = module.project.project_id
|
||||||
network = module.vpc-spoke-2.name
|
network = module.vpc-spoke-2.name
|
||||||
admin_ranges_enabled = true
|
admin_ranges_enabled = true
|
||||||
admin_ranges = values(var.ip_ranges)
|
admin_ranges = values(var.ip_ranges)
|
||||||
|
@ -123,10 +155,10 @@ module "vpc-spoke-2-firewall" {
|
||||||
|
|
||||||
module "nat-spoke-2" {
|
module "nat-spoke-2" {
|
||||||
source = "../../modules/net-cloudnat"
|
source = "../../modules/net-cloudnat"
|
||||||
project_id = var.project_id
|
project_id = module.project.project_id
|
||||||
region = var.region
|
region = var.region
|
||||||
name = "spoke-2"
|
name = "${local.prefix}spoke-2"
|
||||||
router_name = "spoke-2"
|
router_name = "${local.prefix}spoke-2"
|
||||||
router_network = module.vpc-spoke-2.self_link
|
router_network = module.vpc-spoke-2.self_link
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,14 +175,32 @@ module "hub-to-spoke-2-peering" {
|
||||||
# Test VMs #
|
# Test VMs #
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
module "vm-hub" {
|
||||||
|
source = "../../modules/compute-vm"
|
||||||
|
project_id = module.project.project_id
|
||||||
|
region = var.region
|
||||||
|
name = "${local.prefix}hub"
|
||||||
|
network_interfaces = [{
|
||||||
|
network = module.vpc-hub.self_link
|
||||||
|
subnetwork = module.vpc-hub.subnet_self_links["${var.region}/${local.prefix}hub-1"]
|
||||||
|
nat = false
|
||||||
|
addresses = null
|
||||||
|
alias_ips = null
|
||||||
|
}]
|
||||||
|
metadata = { startup-script = local.vm-startup-script }
|
||||||
|
service_account = module.service-account-gce.email
|
||||||
|
service_account_scopes = ["https://www.googleapis.com/auth/cloud-platform"]
|
||||||
|
tags = ["ssh"]
|
||||||
|
}
|
||||||
|
|
||||||
module "vm-spoke-1" {
|
module "vm-spoke-1" {
|
||||||
source = "../../modules/compute-vm"
|
source = "../../modules/compute-vm"
|
||||||
project_id = var.project_id
|
project_id = module.project.project_id
|
||||||
region = var.region
|
region = var.region
|
||||||
name = "spoke-1-test"
|
name = "${local.prefix}spoke-1"
|
||||||
network_interfaces = [{
|
network_interfaces = [{
|
||||||
network = module.vpc-spoke-1.self_link
|
network = module.vpc-spoke-1.self_link
|
||||||
subnetwork = module.vpc-spoke-1.subnet_self_links["${var.region}/spoke-1-default"]
|
subnetwork = module.vpc-spoke-1.subnet_self_links["${var.region}/${local.prefix}spoke-1-1"]
|
||||||
nat = false
|
nat = false
|
||||||
addresses = null
|
addresses = null
|
||||||
alias_ips = null
|
alias_ips = null
|
||||||
|
@ -163,12 +213,12 @@ module "vm-spoke-1" {
|
||||||
|
|
||||||
module "vm-spoke-2" {
|
module "vm-spoke-2" {
|
||||||
source = "../../modules/compute-vm"
|
source = "../../modules/compute-vm"
|
||||||
project_id = var.project_id
|
project_id = module.project.project_id
|
||||||
region = var.region
|
region = var.region
|
||||||
name = "spoke-2-test"
|
name = "${local.prefix}spoke-2"
|
||||||
network_interfaces = [{
|
network_interfaces = [{
|
||||||
network = module.vpc-spoke-2.self_link
|
network = module.vpc-spoke-2.self_link
|
||||||
subnetwork = module.vpc-spoke-2.subnet_self_links["${var.region}/spoke-2-default"]
|
subnetwork = module.vpc-spoke-2.subnet_self_links["${var.region}/${local.prefix}spoke-2-1"]
|
||||||
nat = false
|
nat = false
|
||||||
addresses = null
|
addresses = null
|
||||||
alias_ips = null
|
alias_ips = null
|
||||||
|
@ -181,8 +231,8 @@ module "vm-spoke-2" {
|
||||||
|
|
||||||
module "service-account-gce" {
|
module "service-account-gce" {
|
||||||
source = "../../modules/iam-service-account"
|
source = "../../modules/iam-service-account"
|
||||||
project_id = var.project_id
|
project_id = module.project.project_id
|
||||||
name = "gce-test"
|
name = "${local.prefix}gce-test"
|
||||||
iam_project_roles = {
|
iam_project_roles = {
|
||||||
(var.project_id) = [
|
(var.project_id) = [
|
||||||
"roles/container.developer",
|
"roles/container.developer",
|
||||||
|
@ -198,11 +248,11 @@ module "service-account-gce" {
|
||||||
|
|
||||||
module "cluster-1" {
|
module "cluster-1" {
|
||||||
source = "../../modules/gke-cluster"
|
source = "../../modules/gke-cluster"
|
||||||
name = "cluster-1"
|
name = "${local.prefix}cluster-1"
|
||||||
project_id = var.project_id
|
project_id = module.project.project_id
|
||||||
location = "${var.region}-b"
|
location = "${var.region}-b"
|
||||||
network = module.vpc-spoke-2.self_link
|
network = module.vpc-spoke-2.self_link
|
||||||
subnetwork = module.vpc-spoke-2.subnet_self_links["${var.region}/spoke-2-default"]
|
subnetwork = module.vpc-spoke-2.subnet_self_links["${var.region}/${local.prefix}spoke-2-1"]
|
||||||
secondary_range_pods = "pods"
|
secondary_range_pods = "pods"
|
||||||
secondary_range_services = "services"
|
secondary_range_services = "services"
|
||||||
default_max_pods_per_node = 32
|
default_max_pods_per_node = 32
|
||||||
|
@ -217,12 +267,17 @@ module "cluster-1" {
|
||||||
enable_private_endpoint = true
|
enable_private_endpoint = true
|
||||||
master_ipv4_cidr_block = var.private_service_ranges.spoke-2-cluster-1
|
master_ipv4_cidr_block = var.private_service_ranges.spoke-2-cluster-1
|
||||||
}
|
}
|
||||||
|
peering_config = {
|
||||||
|
export_routes = true
|
||||||
|
import_routes = false
|
||||||
|
project_id = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module "cluster-1-nodepool-1" {
|
module "cluster-1-nodepool-1" {
|
||||||
source = "../../modules/gke-nodepool"
|
source = "../../modules/gke-nodepool"
|
||||||
name = "nodepool-1"
|
name = "${local.prefix}nodepool-1"
|
||||||
project_id = var.project_id
|
project_id = module.project.project_id
|
||||||
location = module.cluster-1.location
|
location = module.cluster-1.location
|
||||||
cluster_name = module.cluster-1.name
|
cluster_name = module.cluster-1.name
|
||||||
node_service_account = module.service-account-gke-node.email
|
node_service_account = module.service-account-gke-node.email
|
||||||
|
@ -233,8 +288,8 @@ module "cluster-1-nodepool-1" {
|
||||||
|
|
||||||
module "service-account-gke-node" {
|
module "service-account-gke-node" {
|
||||||
source = "../../modules/iam-service-account"
|
source = "../../modules/iam-service-account"
|
||||||
project_id = var.project_id
|
project_id = module.project.project_id
|
||||||
name = "gke-node"
|
name = "${local.prefix}gke-node"
|
||||||
iam_project_roles = {
|
iam_project_roles = {
|
||||||
(var.project_id) = [
|
(var.project_id) = [
|
||||||
"roles/logging.logWriter", "roles/monitoring.metricWriter",
|
"roles/logging.logWriter", "roles/monitoring.metricWriter",
|
||||||
|
@ -248,10 +303,10 @@ module "service-account-gke-node" {
|
||||||
|
|
||||||
module "vpn-hub" {
|
module "vpn-hub" {
|
||||||
source = "../../modules/net-vpn-static"
|
source = "../../modules/net-vpn-static"
|
||||||
project_id = var.project_id
|
project_id = module.project.project_id
|
||||||
region = var.region
|
region = var.region
|
||||||
network = module.vpc-hub.name
|
network = module.vpc-hub.name
|
||||||
name = "hub"
|
name = "${local.prefix}hub"
|
||||||
remote_ranges = values(var.private_service_ranges)
|
remote_ranges = values(var.private_service_ranges)
|
||||||
tunnels = {
|
tunnels = {
|
||||||
spoke-2 = {
|
spoke-2 = {
|
||||||
|
@ -265,10 +320,10 @@ module "vpn-hub" {
|
||||||
|
|
||||||
module "vpn-spoke-2" {
|
module "vpn-spoke-2" {
|
||||||
source = "../../modules/net-vpn-static"
|
source = "../../modules/net-vpn-static"
|
||||||
project_id = var.project_id
|
project_id = module.project.project_id
|
||||||
region = var.region
|
region = var.region
|
||||||
network = module.vpc-spoke-2.name
|
network = module.vpc-spoke-2.name
|
||||||
name = "spoke-2"
|
name = "${local.prefix}spoke-2"
|
||||||
# use an aggregate of the remote ranges, so as to be less specific than the
|
# use an aggregate of the remote ranges, so as to be less specific than the
|
||||||
# routes exchanged via peering
|
# routes exchanged via peering
|
||||||
remote_ranges = ["10.0.0.0/8"]
|
remote_ranges = ["10.0.0.0/8"]
|
||||||
|
|
|
@ -12,6 +12,11 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
output "project" {
|
||||||
|
description = "Project id."
|
||||||
|
value = module.project.project_id
|
||||||
|
}
|
||||||
|
|
||||||
output "vms" {
|
output "vms" {
|
||||||
description = "GCE VMs."
|
description = "GCE VMs."
|
||||||
value = {
|
value = {
|
||||||
|
|
|
@ -31,6 +31,12 @@ variable "ip_secondary_ranges" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "prefix" {
|
||||||
|
description = "Arbitrary string used to prefix resource names."
|
||||||
|
type = string
|
||||||
|
default = null
|
||||||
|
}
|
||||||
|
|
||||||
variable "private_service_ranges" {
|
variable "private_service_ranges" {
|
||||||
description = "Private service IP CIDR ranges."
|
description = "Private service IP CIDR ranges."
|
||||||
type = map(string)
|
type = map(string)
|
||||||
|
@ -39,8 +45,26 @@ variable "private_service_ranges" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "project_create" {
|
||||||
|
description = "Set to non null if project needs to be created."
|
||||||
|
type = object({
|
||||||
|
billing_account = string
|
||||||
|
oslogin = bool
|
||||||
|
parent = string
|
||||||
|
})
|
||||||
|
default = null
|
||||||
|
validation {
|
||||||
|
condition = (
|
||||||
|
var.project_create == null
|
||||||
|
? true
|
||||||
|
: can(regex("(organizations|folders)/[0-9]+", var.project_create.parent))
|
||||||
|
)
|
||||||
|
error_message = "Project parent must be of the form folders/folder_id or organizations/organization_id."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
variable "project_id" {
|
variable "project_id" {
|
||||||
description = "Project id for all resources."
|
description = "Project id used for all resources."
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,5 +16,10 @@
|
||||||
|
|
||||||
module "test" {
|
module "test" {
|
||||||
source = "../../../../networking/hub-and-spoke-peering"
|
source = "../../../../networking/hub-and-spoke-peering"
|
||||||
|
project_create = {
|
||||||
|
billing_account = "123456-123456-123456"
|
||||||
|
oslogin = true
|
||||||
|
parent = "folders/123456789"
|
||||||
|
}
|
||||||
project_id = var.project_id
|
project_id = var.project_id
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,5 +23,5 @@ FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'fixture')
|
||||||
def test_resources(e2e_plan_runner):
|
def test_resources(e2e_plan_runner):
|
||||||
"Test that plan works and the numbers of resources is as expected."
|
"Test that plan works and the numbers of resources is as expected."
|
||||||
modules, resources = e2e_plan_runner(FIXTURES_DIR)
|
modules, resources = e2e_plan_runner(FIXTURES_DIR)
|
||||||
assert len(modules) == 18
|
assert len(modules) == 21
|
||||||
assert len(resources) == 53
|
assert len(resources) == 61
|
||||||
|
|
Loading…
Reference in New Issue