Skip to content

Commit

Permalink
feat: Allow the use of Google provider v3.x (#78)
Browse files Browse the repository at this point in the history
* allow the use of the google provider version 3.x

* templates fix
  • Loading branch information
morgante authored Mar 5, 2020
1 parent dd71466 commit eea5267
Show file tree
Hide file tree
Showing 22 changed files with 44 additions and 30 deletions.
6 changes: 4 additions & 2 deletions autogen/main.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ locals {
data "google_compute_zones" "available" {
{% if mig %}
project = var.project_id
{% endif %}
region = var.region
{% else %}
region = var.region
{% endif %}
}

resource "google_compute_region_instance_group_manager" "{{ module_name }}" {
Expand All @@ -46,7 +48,7 @@ resource "google_compute_region_instance_group_manager" "{{ module_name }}" {
instance_template = var.instance_template
}
{% else %}
version {
version {
name = "${var.hostname}-mig-version-0"
instance_template = var.instance_template_initial_version
}
Expand Down
4 changes: 2 additions & 2 deletions autogen/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
terraform {
required_version = "~> 0.12.6"
required_providers {
google = "~> 2.7"
google-beta = "~> 2.7"
google = ">= 2.7, <4.0"
google-beta = ">= 2.7, <4.0"
}
}
2 changes: 1 addition & 1 deletion examples/compute_instance/simple/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

provider "google" {

version = "~> 2.7.0"
version = "~> 3.0"
}

module "instance_template" {
Expand Down
2 changes: 1 addition & 1 deletion examples/instance_template/additional_disks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ provider "google" {

project = var.project_id
region = var.region
version = "~> 2.7.0"
version = "~> 3.0"
}

module "instance_template" {
Expand Down
2 changes: 1 addition & 1 deletion examples/instance_template/simple/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ provider "google" {

project = var.project_id
region = var.region
version = "~> 2.7.0"
version = "~> 3.0"
}

resource "google_compute_address" "ip_address" {
Expand Down
4 changes: 2 additions & 2 deletions examples/mig/autoscaler/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ provider "google" {

project = var.project_id
region = var.region
version = "~> 2.7.0"
version = "~>3.0"
}

provider "google-beta" {

project = var.project_id
region = var.region
version = "~> 2.7.0"
version = "~> 3.0"
}

module "instance_template" {
Expand Down
4 changes: 2 additions & 2 deletions examples/mig/full/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ provider "google" {

project = var.project_id
region = var.region
version = "~> 2.7.0"
version = "~>3.0"
}

provider "google-beta" {

project = var.project_id
region = var.region
version = "~> 2.7.0"
version = "~> 3.0"
}

module "instance_template" {
Expand Down
4 changes: 2 additions & 2 deletions examples/mig/simple/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
provider "google" {

region = var.region
version = "~> 2.7.0"
version = "~> 3.0"
}

provider "google-beta" {

region = var.region
version = "~> 2.7.0"
version = "~> 3.0"
}

module "instance_template" {
Expand Down
2 changes: 2 additions & 0 deletions examples/mig_with_percent/simple/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ managed instance group.

| Name | Description |
|------|-------------|
| preemptible\_self\_link | Self-link of preemptible instance template |
| region | The GCP region to create and test resources in |
| regular\_self\_link | Self-link of regular instance template |
| self\_link | Self-link of the managed instance group |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
4 changes: 2 additions & 2 deletions examples/mig_with_percent/simple/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ provider "google" {

project = var.project_id
region = var.region
version = "~> 2.11"
version = "~> 3.0"
}

provider "google-beta" {

project = var.project_id
region = var.region
version = "~> 2.11"
version = "~> 3.0"
}

module "preemptible_and_regular_instance_templates" {
Expand Down
10 changes: 10 additions & 0 deletions examples/mig_with_percent/simple/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,13 @@ output "region" {
description = "The GCP region to create and test resources in"
value = var.region
}

output "preemptible_self_link" {
description = "Self-link of preemptible instance template"
value = module.preemptible_and_regular_instance_templates.preemptible_self_link
}

output "regular_self_link" {
description = "Self-link of regular instance template"
value = module.preemptible_and_regular_instance_templates.regular_self_link
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ provider "google" {

project = var.project_id
region = var.region
version = "~> 2.11"
version = "~> 3.0"
}

module "preemptible_and_regular_instance_templates" {
Expand Down
2 changes: 1 addition & 1 deletion examples/umig/full/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ provider "google" {

project = var.project_id
region = var.region
version = "~> 2.7.0"
version = "~> 3.0"
}

resource "google_compute_address" "ip_address" {
Expand Down
2 changes: 1 addition & 1 deletion examples/umig/named_ports/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ provider "google" {

project = var.project_id
region = var.region
version = "~> 2.7.0"
version = "~> 3.0"
}

module "instance_template" {
Expand Down
2 changes: 1 addition & 1 deletion examples/umig/simple/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ provider "google" {

project = var.project_id
region = var.region
version = "~> 2.7.0"
version = "~> 3.0"
}

module "instance_template" {
Expand Down
2 changes: 1 addition & 1 deletion examples/umig/static_ips/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ provider "google" {

project = var.project_id
region = var.region
version = "~> 2.7.0"
version = "~> 3.0"
}

module "instance_template" {
Expand Down
2 changes: 1 addition & 1 deletion modules/compute_instance/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
terraform {
required_version = "~> 0.12.6"
required_providers {
google = "~> 2.7"
google = ">= 2.7, <4.0"
}
}
2 changes: 1 addition & 1 deletion modules/instance_template/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
terraform {
required_version = "~> 0.12.6"
required_providers {
google = "~> 2.7"
google = ">= 2.7, <4.0"
}
}
4 changes: 2 additions & 2 deletions modules/mig/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
terraform {
required_version = "~> 0.12.6"
required_providers {
google = "~> 2.7"
google-beta = "~> 2.7"
google = ">= 2.7, <4.0"
google-beta = ">= 2.7, <4.0"
}
}
4 changes: 2 additions & 2 deletions modules/mig_with_percent/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
terraform {
required_version = "~> 0.12.6"
required_providers {
google = "~> 2.7"
google-beta = "~> 2.7"
google = ">= 2.7, <4.0"
google-beta = ">= 2.7, <4.0"
}
}
2 changes: 1 addition & 1 deletion modules/umig/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
terraform {
required_version = "~> 0.12.6"
required_providers {
google = "~> 2.7"
google = ">= 2.7, <4.0"
}
}
6 changes: 3 additions & 3 deletions test/setup/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/

provider "google" {
version = "~> 2.12.0"
version = "~> 3.0"
}

provider "google-beta" {
version = "~> 2.12.0"
version = "~> 3.0"
}

provider "null" {
Expand All @@ -32,7 +32,7 @@ provider "random" {

module "project_ci_vm" {
source = "terraform-google-modules/project-factory/google"
version = "~> 3.0"
version = "~> 7.0"

name = "ci-vm-module"
random_project_id = true
Expand Down

0 comments on commit eea5267

Please sign in to comment.