Skip to content

Commit

Permalink
feat: update TPG version constraints to allow 4.0 (#215)
Browse files Browse the repository at this point in the history
* feat: update TPG version constraints to allow 4.0

* Loosens Google provider constraints

* breaking changes in 4.0 are k8s-specific

* Updates template

* Replaces self_link with id

* Corrects documentation

Co-authored-by: cloud-foundation-bot <[email protected]>
  • Loading branch information
jackwhelpton and cloud-foundation-bot authored Nov 24, 2021
1 parent 9e48c1f commit af7347b
Show file tree
Hide file tree
Showing 50 changed files with 197 additions and 108 deletions.
4 changes: 2 additions & 2 deletions autogen/versions.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
terraform {
required_version = ">=0.13.0"
required_providers {
google = ">= 3.43, <4.0"
google-beta = ">= 3.43, <4.0"
google = ">= 3.43, < 5.0"
google-beta = ">= 3.43, < 5.0"
}
provider_meta "google" {
module_name = "blueprints/terraform/terraform-google-vm:{% if mig %}mig{% else %}mig_with_percent{% endif %}/v7.2.0"
Expand Down
4 changes: 0 additions & 4 deletions examples/compute_instance/disk_snapshot/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
* limitations under the License.
*/

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

# Building the list of disk names in the required format.
# Usually you would build this list from the outputs of the compute_instance module
locals {
Expand Down
8 changes: 7 additions & 1 deletion examples/compute_instance/disk_snapshot/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@
*/

terraform {
required_version = ">=0.12.6"
required_version = ">= 0.13"
required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.0"
}
}
}
11 changes: 0 additions & 11 deletions examples/compute_instance/multiple_interfaces/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,6 @@
* limitations under the License.
*/

terraform {
required_providers {
google = {
version = ">= 3.45.0"
}
null = {
version = ">= 2.1.0"
}
}
}

# [START compute_vm_with_multiple_interface]
resource "google_compute_instance" "default" {
project = var.project_id # Replace with your project ID in quotes
Expand Down
12 changes: 11 additions & 1 deletion examples/compute_instance/multiple_interfaces/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,15 @@
*/

terraform {
required_version = ">=0.12.6"
required_version = ">= 0.13"
required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.0"
}
null = {
source = "hashicorp/null"
version = ">= 2.1.0"
}
}
}
5 changes: 0 additions & 5 deletions examples/compute_instance/next_hop/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
* limitations under the License.
*/

provider "google" {

version = "~> 3.0"
}

# [START compute_vm_as_next_hop_create]
resource "google_compute_instance" "default" {
project = var.project_id # Replace this with your project ID in quotes
Expand Down
8 changes: 7 additions & 1 deletion examples/compute_instance/next_hop/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@
*/

terraform {
required_version = ">=0.12.6"
required_version = ">= 0.13"
required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.0"
}
}
}
5 changes: 0 additions & 5 deletions examples/compute_instance/simple/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
* limitations under the License.
*/

provider "google" {

version = "~> 3.0"
}

module "instance_template" {
source = "../../../modules/instance_template"
region = var.region
Expand Down
8 changes: 7 additions & 1 deletion examples/compute_instance/simple/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@
*/

terraform {
required_version = ">=0.12.6"
required_version = ">= 0.13"
required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.0"
}
}
}
5 changes: 0 additions & 5 deletions examples/compute_instance/tags/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
* limitations under the License.
*/

provider "google" {

version = "~> 3.0"
}

# [START compute_vm_with_tags_create]
resource "google_compute_instance" "default" {
project = var.project_id # Replace this with your project ID in quotes
Expand Down
8 changes: 7 additions & 1 deletion examples/compute_instance/tags/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@
*/

terraform {
required_version = ">=0.12.6"
required_version = ">= 0.13"
required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.0"
}
}
}
1 change: 0 additions & 1 deletion examples/instance_template/additional_disks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ provider "google" {

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

module "instance_template" {
Expand Down
8 changes: 7 additions & 1 deletion examples/instance_template/additional_disks/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@
*/

terraform {
required_version = ">=0.12.6"
required_version = ">= 0.13"
required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.0"
}
}
}
1 change: 0 additions & 1 deletion examples/instance_template/alias_ip_range/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ provider "google" {

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

resource "google_compute_address" "ip_address" {
Expand Down
8 changes: 7 additions & 1 deletion examples/instance_template/alias_ip_range/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@
*/

terraform {
required_version = ">=0.12.6"
required_version = ">= 0.13"
required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.0"
}
}
}
3 changes: 1 addition & 2 deletions examples/instance_template/encrypted_disks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ provider "google" {

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

resource "google_kms_key_ring" "keyring" {
Expand All @@ -43,7 +42,7 @@ module "instance_template" {
service_account = var.service_account
name_prefix = "additional-disks"

disk_encryption_key = google_kms_crypto_key.example-key.self_link
disk_encryption_key = google_kms_crypto_key.example-key.id

additional_disks = [
{
Expand Down
8 changes: 7 additions & 1 deletion examples/instance_template/encrypted_disks/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@
*/

terraform {
required_version = ">=0.12.6"
required_version = ">= 0.13"
required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.0"
}
}
}
1 change: 0 additions & 1 deletion examples/instance_template/simple/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ provider "google" {

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

resource "google_compute_address" "ip_address" {
Expand Down
8 changes: 7 additions & 1 deletion examples/instance_template/simple/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@
*/

terraform {
required_version = ">=0.12.6"
required_version = ">= 0.13"
required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.0"
}
}
}
2 changes: 0 additions & 2 deletions examples/mig/autoscaler/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ provider "google" {

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

provider "google-beta" {

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

module "instance_template" {
Expand Down
12 changes: 11 additions & 1 deletion examples/mig/autoscaler/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,15 @@
*/

terraform {
required_version = ">=0.12.6"
required_version = ">= 0.13"
required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.0"
}
google-beta = {
source = "hashicorp/google-beta"
version = "~> 4.0"
}
}
}
2 changes: 0 additions & 2 deletions examples/mig/full/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ provider "google" {

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

provider "google-beta" {

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

module "instance_template" {
Expand Down
12 changes: 11 additions & 1 deletion examples/mig/full/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,15 @@
*/

terraform {
required_version = ">=0.12.6"
required_version = ">= 0.13"
required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.0"
}
google-beta = {
source = "hashicorp/google-beta"
version = "~> 4.0"
}
}
}
8 changes: 0 additions & 8 deletions examples/mig/healthcheck/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,11 @@
provider "google" {
project = var.project_id
region = var.region
version = "~>3.0"
}

provider "google-beta" {
project = var.project_id
region = var.region
version = "~> 3.0"
}

/** Random String (optional) **/

provider "random" {
version = "~> 2.2"
}

resource "random_string" "suffix" {
Expand Down
16 changes: 15 additions & 1 deletion examples/mig/healthcheck/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,19 @@
*/

terraform {
required_version = ">=0.12.6"
required_version = ">= 0.13"
required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.0"
}
google-beta = {
source = "hashicorp/google-beta"
version = "~> 4.0"
}
random = {
source = "hashicorp/random"
version = "~> 2.2"
}
}
}
6 changes: 2 additions & 4 deletions examples/mig/simple/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@

provider "google" {

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

provider "google-beta" {

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

module "instance_template" {
Expand Down
12 changes: 11 additions & 1 deletion examples/mig/simple/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,15 @@
*/

terraform {
required_version = ">=0.12.6"
required_version = ">= 0.13"
required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.0"
}
google-beta = {
source = "hashicorp/google-beta"
version = "~> 4.0"
}
}
}
2 changes: 0 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,12 @@ provider "google" {

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

provider "google-beta" {

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

module "preemptible_and_regular_instance_templates" {
Expand Down
Loading

0 comments on commit af7347b

Please sign in to comment.