Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

Commit

Permalink
Merge pull request #26 from gruntwork-io/tf12
Browse files Browse the repository at this point in the history
Terraform 0.12 upgrade
  • Loading branch information
autero1 authored Jun 11, 2019
2 parents 4a90f39 + 8fe01e5 commit da469be
Show file tree
Hide file tree
Showing 34 changed files with 562 additions and 380 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defaults: &defaults
GRUNTWORK_INSTALLER_VERSION: v0.0.21
TERRATEST_LOG_PARSER_VERSION: v0.13.13
MODULE_CI_VERSION: v0.13.3
TERRAFORM_VERSION: 0.11.8
TERRAFORM_VERSION: 0.12.1
TERRAGRUNT_VERSION: NONE
PACKER_VERSION: NONE
GOLANG_VERSION: 1.11.2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Maintained by Gruntwork.io](https://img.shields.io/badge/maintained%20by-gruntwork.io-%235849a6.svg)](https://gruntwork.io/?ref=repo_google_network)
[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/gruntwork-io/terraform-google-network.svg?label=latest)](https://github.com/gruntwork-io/terraform-google-network/releases/latest)

![Terraform Version](https://img.shields.io/badge/tf-%3E%3D0.12.0-blue.svg)
# Google VPC Network Modules

This repo contains modules for creating [Virtual Private Cloud (VPC) networks](https://cloud.google.com/vpc/docs/vpc) on
Expand Down
25 changes: 16 additions & 9 deletions examples/bastion-host/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
terraform {
# The modules used in this example have been updated with 0.12 syntax, which means the example is no longer
# compatible with any versions below 0.12.
required_version = ">= 0.12"
}

# ---------------------------------------------------------------------------------------------------------------------
# Create a Management Network for shared services
# ---------------------------------------------------------------------------------------------------------------------
Expand All @@ -8,9 +14,9 @@ module "management_network" {
# source = "github.com/gruntwork-io/terraform-google-network.git//modules/vpc-network?ref=v0.1.2"
source = "../../modules/vpc-network"

name_prefix = "${var.name_prefix}"
project = "${var.project}"
region = "${var.region}"
name_prefix = var.name_prefix
project = var.project
region = var.region
}

# ---------------------------------------------------------------------------------------------------------------------
Expand All @@ -24,10 +30,10 @@ module "bastion_host" {
source = "../../modules/bastion-host"

instance_name = "${var.name_prefix}-vm"
subnetwork = "${module.management_network.public_subnetwork}"
subnetwork = module.management_network.public_subnetwork

project = "${var.project}"
zone = "${var.zone}"
project = var.project
zone = var.zone
}

# ---------------------------------------------------------------------------------------------------------------------
Expand All @@ -37,11 +43,11 @@ module "bastion_host" {
resource "google_compute_instance" "private" {
name = "${var.name_prefix}-private"
machine_type = "n1-standard-1"
zone = "${var.zone}"
zone = var.zone

allow_stopping_for_update = true

tags = ["${module.management_network.private}"]
tags = [module.management_network.private]

boot_disk {
initialize_params {
Expand All @@ -50,10 +56,11 @@ resource "google_compute_instance" "private" {
}

network_interface {
subnetwork = "${module.management_network.private_subnetwork}"
subnetwork = module.management_network.private_subnetwork
}

metadata = {
enable-oslogin = "TRUE"
}
}

5 changes: 3 additions & 2 deletions examples/bastion-host/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
output "address" {
description = "The public IP of the bastion host."
value = "${module.bastion_host.address}"
value = module.bastion_host.address
}

output "private_instance" {
description = "A reference (self_link) to the private instance"
value = "${google_compute_instance.private.self_link}"
value = google_compute_instance.private.self_link
}

5 changes: 5 additions & 0 deletions examples/bastion-host/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@

variable "project" {
description = "The name of the GCP Project where all resources will be launched."
type = string
}

variable "region" {
description = "The region in which the VPC netowrk's subnetwork will be created."
type = string
}

variable "zone" {
description = "The zone in which the bastion host VM instance will be launched. Must be within the region."
type = string
}

# ---------------------------------------------------------------------------------------------------------------------
Expand All @@ -22,5 +25,7 @@ variable "zone" {

variable "name_prefix" {
description = "A name prefix used in resource names to ensure uniqueness across a project."
type = string
default = "bastion"
}

15 changes: 11 additions & 4 deletions examples/network-host-application/main.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
terraform {
# The modules used in this example have been updated with 0.12 syntax, which means the example is no longer
# compatible with any versions below 0.12.
required_version = ">= 0.12"
}

module "application_network" {
# When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you
# to a specific version of the modules, such as the following example:
# source = "github.com/gruntwork-io/terraform-google-network.git//modules/vpc-network?ref=v0.1.2"
source = "../../modules/vpc-network"

name_prefix = "${var.name_prefix}"
project = "${var.project}"
region = "${var.region}"
name_prefix = var.name_prefix
project = var.project
region = var.region
}

module "project_host_configuration" {
Expand All @@ -15,5 +21,6 @@ module "project_host_configuration" {
# source = "github.com/gruntwork-io/terraform-google-network.git//modules/project-host-configuration?ref=v0.1.2"
source = "../../modules/project-host-configuration"

project = "${var.project}"
project = var.project
}

25 changes: 13 additions & 12 deletions examples/network-host-application/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
output "network" {
description = "A reference (self_link) to the VPC network"
value = "${module.application_network.network}"
value = module.application_network.network
}

# ---------------------------------------------------------------------------------------------------------------------
Expand All @@ -9,19 +9,19 @@ output "network" {

output "public_subnetwork" {
description = "A reference (self_link) to the public subnetwork"
value = "${module.application_network.public_subnetwork}"
value = module.application_network.public_subnetwork
}

output "public_subnetwork_cidr_block" {
value = "${module.application_network.public_subnetwork_cidr_block}"
value = module.application_network.public_subnetwork_cidr_block
}

output "public_subnetwork_gateway" {
value = "${module.application_network.public_subnetwork_gateway}"
value = module.application_network.public_subnetwork_gateway
}

output "public_subnetwork_secondary_cidr_block" {
value = "${module.application_network.public_subnetwork_secondary_cidr_block}"
value = module.application_network.public_subnetwork_secondary_cidr_block
}

# ---------------------------------------------------------------------------------------------------------------------
Expand All @@ -30,19 +30,19 @@ output "public_subnetwork_secondary_cidr_block" {

output "private_subnetwork" {
description = "A reference (self_link) to the private subnetwork"
value = "${module.application_network.private_subnetwork}"
value = module.application_network.private_subnetwork
}

output "private_subnetwork_cidr_block" {
value = "${module.application_network.private_subnetwork_cidr_block}"
value = module.application_network.private_subnetwork_cidr_block
}

output "private_subnetwork_gateway" {
value = "${module.application_network.private_subnetwork_gateway}"
value = module.application_network.private_subnetwork_gateway
}

output "private_subnetwork_secondary_cidr_block" {
value = "${module.application_network.private_subnetwork_secondary_cidr_block}"
value = module.application_network.private_subnetwork_secondary_cidr_block
}

# ---------------------------------------------------------------------------------------------------------------------
Expand All @@ -51,15 +51,16 @@ output "private_subnetwork_secondary_cidr_block" {

output "public" {
description = "The network tag string used for the public access tier"
value = "${module.application_network.public}"
value = module.application_network.public
}

output "private" {
description = "The network tag string used for the private access tier"
value = "${module.application_network.private}"
value = module.application_network.private
}

output "private_persistence" {
description = "The network tag string used for the private-persistence access tier"
value = "${module.application_network.private_persistence}"
value = module.application_network.private_persistence
}

4 changes: 4 additions & 0 deletions examples/network-host-application/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@

variable "project" {
description = "The name of the GCP Project where all resources will be launched."
type = string
}

variable "region" {
description = "The Region in which all GCP resources will be launched."
type = string
}

# ---------------------------------------------------------------------------------------------------------------------
Expand All @@ -18,5 +20,7 @@ variable "region" {

variable "name_prefix" {
description = "A name prefix used in resource names to ensure uniqueness across a project."
type = string
default = "application"
}

Loading

0 comments on commit da469be

Please sign in to comment.