Skip to content

Commit

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

* bump dep modules

* pin pf to minor

Co-authored-by: bharathkkb <bharathkrishnakb@gmail.com>
  • Loading branch information
cloud-foundation-bot and bharathkkb committed Dec 13, 2021
1 parent a7f39a9 commit 71aa344
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 59 deletions.
17 changes: 0 additions & 17 deletions examples/cloudbuild_enabled/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,6 @@
* limitations under the License.
*/


provider "google" {
version = ">= 3.50"
}

provider "google-beta" {
version = ">= 3.50"
}

provider "null" {
version = "~> 2.1"
}

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

/*************************************************
Bootstrap GCP Organization.
*************************************************/
Expand Down
37 changes: 37 additions & 0 deletions examples/cloudbuild_enabled/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.0"
}
google-beta = {
source = "hashicorp/google-beta"
version = "~> 4.0"
}
null = {
source = "hashicorp/null"
version = "~> 2.1"
}
random = {
source = "hashicorp/random"
version = "~> 2.2"
}
}
required_version = ">= 0.13"
}
12 changes: 0 additions & 12 deletions examples/simple-folder/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,6 @@
* limitations under the License.
*/

provider "google" {
version = ">= 3.50"
}

provider "null" {
version = "~> 2.1"
}

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

/*************************************************
Bootstrap GCP Folder.
*************************************************/
Expand Down
33 changes: 33 additions & 0 deletions examples/simple-folder/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

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

provider "google" {
version = ">= 3.50"
}

provider "null" {
version = "~> 2.1"
}

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

/*************************************************
Bootstrap GCP Organization.
*************************************************/
Expand Down
33 changes: 33 additions & 0 deletions examples/simple/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.0"
}
null = {
source = "hashicorp/null"
version = "~> 2.1"
}
random = {
source = "hashicorp/random"
version = "~> 2.2"
}
}
required_version = ">= 0.13"
}
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ resource "google_folder_iam_member" "tmp_project_creator" {

module "seed_project" {
source = "terraform-google-modules/project-factory/google"
version = "~> 11.2"
version = "~> 11.3"
name = local.seed_project_id
random_project_id = var.random_suffix
disable_services_on_destroy = false
Expand Down Expand Up @@ -93,7 +93,7 @@ data "google_storage_project_service_account" "gcs_account" {
module "kms" {
count = var.encrypt_gcs_bucket_tfstate ? 1 : 0
source = "terraform-google-modules/kms/google"
version = "~> 1.2"
version = "~> 2.1"

project_id = module.seed_project.project_id
location = var.default_region
Expand Down
8 changes: 4 additions & 4 deletions modules/cloudbuild/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ data "google_organization" "org" {

module "cloudbuild_project" {
source = "terraform-google-modules/project-factory/google"
version = "~> 11.2"
version = "~> 11.3"
name = local.cloudbuild_project_id
random_project_id = var.random_suffix
disable_services_on_destroy = false
Expand Down Expand Up @@ -97,15 +97,15 @@ resource "google_kms_key_ring" "tf_keyring" {

resource "google_kms_crypto_key" "tf_key" {
name = "tf-key"
key_ring = google_kms_key_ring.tf_keyring.self_link
key_ring = google_kms_key_ring.tf_keyring.id
}

/******************************************
Permissions to decrypt.
*****************************************/

resource "google_kms_crypto_key_iam_binding" "cloudbuild_crypto_key_decrypter" {
crypto_key_id = google_kms_crypto_key.tf_key.self_link
crypto_key_id = google_kms_crypto_key.tf_key.id
role = "roles/cloudkms.cryptoKeyDecrypter"

members = [
Expand All @@ -119,7 +119,7 @@ resource "google_kms_crypto_key_iam_binding" "cloudbuild_crypto_key_decrypter" {
*****************************************/

resource "google_kms_crypto_key_iam_binding" "cloud_build_crypto_key_encrypter" {
crypto_key_id = google_kms_crypto_key.tf_key.self_link
crypto_key_id = google_kms_crypto_key.tf_key.id
role = "roles/cloudkms.cryptoKeyEncrypter"

members = [
Expand Down
4 changes: 2 additions & 2 deletions modules/cloudbuild/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
version = ">= 3.50"
version = ">= 3.50, < 5.0"
}
google-beta = {
source = "hashicorp/google-beta"
version = ">= 3.50"
version = ">= 3.50, < 5.0"
}
}

Expand Down
23 changes: 14 additions & 9 deletions test/setup/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
*/

terraform {
required_version = ">= 0.12"
}

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

provider "google-beta" {
version = "~> 3.31"
required_version = ">= 0.13"
required_providers {
google = {
source = "hashicorp/google"
version = "~> 3.31"
}
google-beta = {
source = "hashicorp/google-beta"
version = "~> 3.31"
}
random = {
source = "hashicorp/random"
}
}
}
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
version = ">= 3.50"
version = ">= 3.50, < 5.0"
}
}

Expand Down

0 comments on commit 71aa344

Please sign in to comment.