Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrated to terraform 0.12 #48

Merged
merged 4 commits into from
Jun 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ruby '2.5.3'
ruby '2.6.3'

source 'https://rubygems.org/' do
gem 'kitchen-terraform', '~> 4.3'
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ SHELL := /usr/bin/env bash
# Docker build config variables
CREDENTIALS_PATH ?= /cft/workdir/credentials.json
DOCKER_ORG := gcr.io/cloud-foundation-cicd
DOCKER_TAG_BASE_KITCHEN_TERRAFORM ?= 0.11.10_216.0.0_1.19.1_0.1.10
DOCKER_TAG_BASE_KITCHEN_TERRAFORM ?= 2.0.0
DOCKER_REPO_BASE_KITCHEN_TERRAFORM := ${DOCKER_ORG}/cft/kitchen-terraform:${DOCKER_TAG_BASE_KITCHEN_TERRAFORM}

# All is the first target in the file so it will get picked up when you just run 'make' on its own
Expand Down
14 changes: 7 additions & 7 deletions codelabs/simple/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module "vpc" {
version = "~> 0.4.0"

# Give the network a name and project
project_id = "${google_project_service.compute.project}"
project_id = google_project_service.compute.project
network_name = "my-custom-vpc-${random_id.network_id.hex}"

subnets = [
Expand Down Expand Up @@ -67,7 +67,7 @@ resource "random_id" "instance_id" {
# Launch a VM on it
resource "google_compute_instance" "default" {
name = "vm-${random_id.instance_id.hex}"
project = "${google_project_service.compute.project}"
project = google_project_service.compute.project
machine_type = "f1-micro"
zone = "us-west1-a"

Expand All @@ -78,8 +78,8 @@ resource "google_compute_instance" "default" {
}

network_interface {
subnetwork = "${module.vpc.subnets_names[0]}"
subnetwork_project = "${google_project_service.compute.project}"
subnetwork = module.vpc.subnets_names[0]
subnetwork_project = google_project_service.compute.project

access_config {
# Include this section to give the VM an external ip address
Expand All @@ -93,8 +93,8 @@ resource "google_compute_instance" "default" {
# Allow traffic to the VM
resource "google_compute_firewall" "allow-ping" {
name = "default-ping"
network = "${module.vpc.network_name}"
project = "${google_project_service.compute.project}"
network = module.vpc.network_name
project = google_project_service.compute.project

allow {
protocol = "icmp"
Expand All @@ -106,5 +106,5 @@ resource "google_compute_firewall" "allow-ping" {
}

output "ip" {
value = "${google_compute_instance.default.network_interface.0.access_config.0.nat_ip}"
value = google_compute_instance.default.network_interface.0.access_config.0.nat_ip
}
6 changes: 3 additions & 3 deletions examples/delete_default_gateway_routes/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ locals {

module "test-vpc-module" {
source = "../../"
project_id = "${var.project_id}"
network_name = "${var.network_name}"
project_id = var.project_id
network_name = var.network_name
delete_default_internet_gateway_routes = "true"

subnets = [
{
subnet_name = "${local.subnet_01}"
subnet_name = local.subnet_01
subnet_ip = "10.20.30.0/24"
subnet_region = "us-west1"
},
Expand Down
18 changes: 9 additions & 9 deletions examples/delete_default_gateway_routes/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,46 @@
*/

output "network_name" {
value = "${module.test-vpc-module.network_name}"
value = module.test-vpc-module.network_name
description = "The name of the VPC being created"
}

output "network_self_link" {
value = "${module.test-vpc-module.network_self_link}"
value = module.test-vpc-module.network_self_link
description = "The URI of the VPC being created"
}

output "subnets_names" {
value = "${module.test-vpc-module.subnets_names}"
value = module.test-vpc-module.subnets_names
description = "The names of the subnets being created"
}

output "subnets_ips" {
value = "${module.test-vpc-module.subnets_ips}"
value = module.test-vpc-module.subnets_ips
description = "The IP and cidrs of the subnets being created"
}

output "subnets_regions" {
value = "${module.test-vpc-module.subnets_regions}"
value = module.test-vpc-module.subnets_regions
description = "The region where subnets will be created"
}

output "subnets_private_access" {
value = "${module.test-vpc-module.subnets_private_access}"
value = module.test-vpc-module.subnets_private_access
description = "Whether the subnets will have access to Google API's without a public IP"
}

output "subnets_flow_logs" {
value = "${module.test-vpc-module.subnets_flow_logs}"
value = module.test-vpc-module.subnets_flow_logs
description = "Whether the subnets will have VPC flow logs enabled"
}

output "subnets_secondary_ranges" {
value = "${module.test-vpc-module.subnets_secondary_ranges}"
value = module.test-vpc-module.subnets_secondary_ranges
description = "The secondary ranges associated with these subnets"
}

output "routes" {
value = "${module.test-vpc-module.routes}"
value = module.test-vpc-module.routes
description = "The routes associated with this VPC"
}
16 changes: 8 additions & 8 deletions examples/multi_vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,26 @@ locals {

module "test-vpc-module-01" {
source = "../../"
project_id = "${var.project_id}"
network_name = "${var.network_01_name}"
project_id = var.project_id
network_name = var.network_01_name

subnets = [
{
subnet_name = "${local.network_01_subnet_01}"
subnet_name = local.network_01_subnet_01
subnet_ip = "10.10.10.0/24"
subnet_region = "us-west1"
subnet_private_access = "false"
subnet_flow_logs = "true"
},
{
subnet_name = "${local.network_01_subnet_02}"
subnet_name = local.network_01_subnet_02
subnet_ip = "10.10.20.0/24"
subnet_region = "us-west1"
subnet_private_access = "false"
subnet_flow_logs = "true"
},
{
subnet_name = "${local.network_01_subnet_03}"
subnet_name = local.network_01_subnet_03
subnet_ip = "10.10.30.0/24"
subnet_region = "us-west1"
subnet_private_access = "false"
Expand Down Expand Up @@ -105,8 +105,8 @@ module "test-vpc-module-01" {

module "test-vpc-module-02" {
source = "../../"
project_id = "${var.project_id}"
network_name = "${var.network_02_name}"
project_id = var.project_id
network_name = var.network_02_name

subnets = [
{
Expand Down Expand Up @@ -136,5 +136,5 @@ module "test-vpc-module-02" {
"${local.network_02_subnet_02}" = []
}

routes = "${local.network_02_routes}"
routes = local.network_02_routes
}
36 changes: 18 additions & 18 deletions examples/multi_vpc/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,92 +16,92 @@

# vpc 1
output "network_01_name" {
value = "${module.test-vpc-module-01.network_name}"
value = module.test-vpc-module-01.network_name
description = "The name of the VPC network-01"
}

output "network_01_self_link" {
value = "${module.test-vpc-module-01.network_self_link}"
value = module.test-vpc-module-01.network_self_link
description = "The URI of the VPC network-01"
}

output "network_01_subnets" {
value = "${module.test-vpc-module-01.subnets_names}"
value = module.test-vpc-module-01.subnets_names
description = "The names of the subnets being created on network-01"
}

output "network_01_subnets_ips" {
value = "${module.test-vpc-module-01.subnets_ips}"
value = module.test-vpc-module-01.subnets_ips
description = "The IP and cidrs of the subnets being created on network-01"
}

output "network_01_subnets_regions" {
value = "${module.test-vpc-module-01.subnets_regions}"
value = module.test-vpc-module-01.subnets_regions
description = "The region where the subnets will be created on network-01"
}

output "network_01_subnets_private_access" {
value = "${module.test-vpc-module-01.subnets_private_access}"
value = module.test-vpc-module-01.subnets_private_access
description = "Whether the subnets will have access to Google API's without a public IP on network-01"
}

output "network_01_subnets_flow_logs" {
value = "${module.test-vpc-module-01.subnets_flow_logs}"
value = module.test-vpc-module-01.subnets_flow_logs
description = "Whether the subnets will have VPC flow logs enabled"
}

output "network_01_subnets_secondary_ranges" {
value = "${module.test-vpc-module-01.subnets_secondary_ranges}"
value = module.test-vpc-module-01.subnets_secondary_ranges
description = "The secondary ranges associated with these subnets on network-01"
}

output "network_01_routes" {
value = "${module.test-vpc-module-01.routes}"
value = module.test-vpc-module-01.routes
description = "The routes associated with network-01"
}

# vpc 2
output "network_02_name" {
value = "${module.test-vpc-module-02.network_name}"
value = module.test-vpc-module-02.network_name
description = "The name of the VPC network-02"
}

output "network_02_self_link" {
value = "${module.test-vpc-module-02.network_self_link}"
value = module.test-vpc-module-02.network_self_link
description = "The URI of the VPC network-02"
}

output "network_02_subnets" {
value = "${module.test-vpc-module-02.subnets_names}"
value = module.test-vpc-module-02.subnets_names
description = "The names of the subnets being created on network-02"
}

output "network_02_subnets_ips" {
value = "${module.test-vpc-module-02.subnets_ips}"
value = module.test-vpc-module-02.subnets_ips
description = "The IP and cidrs of the subnets being created on network-02"
}

output "network_02_subnets_regions" {
value = "${module.test-vpc-module-02.subnets_regions}"
value = module.test-vpc-module-02.subnets_regions
description = "The region where the subnets will be created on network-02"
}

output "network_02_subnets_private_access" {
value = "${module.test-vpc-module-02.subnets_private_access}"
value = module.test-vpc-module-02.subnets_private_access
description = "Whether the subnets will have access to Google API's without a public IP on network-02"
}

output "network_02_subnets_flow_logs" {
value = "${module.test-vpc-module-02.subnets_flow_logs}"
value = module.test-vpc-module-02.subnets_flow_logs
description = "Whether the subnets will have VPC flow logs enabled"
}

output "network_02_subnets_secondary_ranges" {
value = "${module.test-vpc-module-02.subnets_secondary_ranges}"
value = module.test-vpc-module-02.subnets_secondary_ranges
description = "The secondary ranges associated with these subnets on network-02"
}

output "network_02_routes" {
value = "${module.test-vpc-module-02.routes}"
value = module.test-vpc-module-02.routes
description = "The routes associated with network-02"
}
4 changes: 2 additions & 2 deletions examples/secondary_ranges/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ locals {

module "vpc-secondary-ranges" {
source = "../../"
project_id = "${var.project_id}"
network_name = "${var.network_name}"
project_id = var.project_id
network_name = var.network_name

subnets = [
{
Expand Down
18 changes: 9 additions & 9 deletions examples/secondary_ranges/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,46 @@
*/

output "network_name" {
value = "${module.vpc-secondary-ranges.network_name}"
value = module.vpc-secondary-ranges.network_name
description = "The name of the VPC being created"
}

output "network_self_link" {
value = "${module.vpc-secondary-ranges.network_self_link}"
value = module.vpc-secondary-ranges.network_self_link
description = "The URI of the VPC being created"
}

output "subnets_names" {
value = "${module.vpc-secondary-ranges.subnets_names}"
value = module.vpc-secondary-ranges.subnets_names
description = "The names of the subnets being created"
}

output "subnets_ips" {
value = "${module.vpc-secondary-ranges.subnets_ips}"
value = module.vpc-secondary-ranges.subnets_ips
description = "The IP and cidrs of the subnets being created"
}

output "subnets_regions" {
value = "${module.vpc-secondary-ranges.subnets_regions}"
value = module.vpc-secondary-ranges.subnets_regions
description = "The region where subnets will be created"
}

output "subnets_private_access" {
value = "${module.vpc-secondary-ranges.subnets_private_access}"
value = module.vpc-secondary-ranges.subnets_private_access
description = "Whether the subnets will have access to Google API's without a public IP"
}

output "subnets_flow_logs" {
value = "${module.vpc-secondary-ranges.subnets_flow_logs}"
value = module.vpc-secondary-ranges.subnets_flow_logs
description = "Whether the subnets will have VPC flow logs enabled"
}

output "subnets_secondary_ranges" {
value = "${flatten(module.vpc-secondary-ranges.subnets_secondary_ranges)}"
value = flatten(module.vpc-secondary-ranges.subnets_secondary_ranges)
description = "The secondary ranges associated with these subnets"
}

output "routes" {
value = "${module.vpc-secondary-ranges.routes}"
value = module.vpc-secondary-ranges.routes
description = "The routes associated with this VPC"
}
4 changes: 2 additions & 2 deletions examples/simple_project/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ locals {

module "test-vpc-module" {
source = "../../"
project_id = "${var.project_id}"
network_name = "${var.network_name}"
project_id = var.project_id
network_name = var.network_name

subnets = [
{
Expand Down
Loading