From 41818b6467a2c1b4132af472c8bff879414fafa7 Mon Sep 17 00:00:00 2001 From: Miguel Lo-A-Foe Date: Sat, 10 Feb 2024 11:02:14 +0100 Subject: [PATCH] specify version constraints --- .terraform.lock.hcl | 9 ++++++--- main.tf | 18 ++++++++++++------ modules/bucket/main.tf | 3 ++- modules/gh/versions.tf | 3 ++- modules/kms/main.tf | 3 ++- versions.tf | 6 ++++-- 6 files changed, 28 insertions(+), 14 deletions(-) diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl index cb78c83..da72a3c 100644 --- a/.terraform.lock.hcl +++ b/.terraform.lock.hcl @@ -2,7 +2,8 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/hashicorp/google" { - version = "5.15.0" + version = "5.15.0" + constraints = ">= 3.43.0, >= 3.45.0, >= 3.50.0, >= 3.53.0, >= 4.28.0, >= 4.46.0, ~> 5.15.0, < 6.0.0" hashes = [ "h1:pqd1xiQWI00Q0OOr5yAyYUHxREMkEVMNvvBLbpS8kHk=", "zh:08cf2452888e9a8a0c853f01add35f790d3db42570e5c3743c4603333c347b48", @@ -61,7 +62,8 @@ provider "registry.terraform.io/hashicorp/null" { } provider "registry.terraform.io/hashicorp/random" { - version = "3.6.0" + version = "3.6.0" + constraints = ">= 2.1.0, >= 2.2.0, >= 3.0.0, ~> 3.6.0" hashes = [ "h1:I8MBeauYA8J8yheLJ8oSMWqB0kovn16dF/wKZ1QTdkk=", "zh:03360ed3ecd31e8c5dac9c95fe0858be50f3e9a0d0c654b5e504109c2159287d", @@ -100,7 +102,8 @@ provider "registry.terraform.io/hashicorp/time" { } provider "registry.terraform.io/integrations/github" { - version = "5.45.0" + version = "5.45.0" + constraints = "~> 5.45.0" hashes = [ "h1:sP/Er9osOsz4vhKZAul+GeV0c5XdvMblJBMiP+T5tWc=", "zh:2afb8ee5b847071e51d5a39bcad5cf466c4d22452450d37c44a5f9d2eb9879e5", diff --git a/main.tf b/main.tf index 3cce7ff..846f460 100644 --- a/main.tf +++ b/main.tf @@ -5,21 +5,24 @@ locals { } module "folder_gh" { - source = "terraform-google-modules/folders/google" + source = "terraform-google-modules/folders/google" + version = "~> 4.0.1" names = [local.gcp_root_folder_name] parent = "organizations/${var.gcp_organization_id}" } module "folder_gh_owner" { - source = "terraform-google-modules/folders/google" + source = "terraform-google-modules/folders/google" + version = "~> 4.0.1" names = [var.gh_owner] parent = module.folder_gh.id } module "project" { - source = "terraform-google-modules/project-factory/google" + source = "terraform-google-modules/project-factory/google" + version = "~> 14.4.0" name = var.gh_repository random_project_id = true @@ -58,7 +61,8 @@ module "workload_identity" { } module "folder_gh_owner_iam_bindings" { - source = "terraform-google-modules/iam/google//modules/folders_iam" + source = "terraform-google-modules/iam/google//modules/folders_iam" + version = "~> 7.7.1" folders = [module.folder_gh_owner.id] bindings = { @@ -77,7 +81,8 @@ module "folder_gh_owner_iam_bindings" { } module "billing_account_iam_bindings" { - source = "terraform-google-modules/iam/google//modules/billing_accounts_iam" + source = "terraform-google-modules/iam/google//modules/billing_accounts_iam" + version = "~> 7.7.1" billing_account_ids = [var.gcp_billing_account_id] bindings = { @@ -88,7 +93,8 @@ module "billing_account_iam_bindings" { } module "workload_identity_iam_bindings" { - source = "terraform-google-modules/iam/google//modules/service_accounts_iam" + source = "terraform-google-modules/iam/google//modules/service_accounts_iam" + version = "~> 7.7.1" project = module.project.project_id service_accounts = [module.project.service_account_email] diff --git a/modules/bucket/main.tf b/modules/bucket/main.tf index 8e19422..0dc3a66 100644 --- a/modules/bucket/main.tf +++ b/modules/bucket/main.tf @@ -11,7 +11,8 @@ module "kms" { } module "bucket" { - source = "terraform-google-modules/cloud-storage/google" + source = "terraform-google-modules/cloud-storage/google" + version = "~> 5.0.0" project_id = var.project_id location = var.location diff --git a/modules/gh/versions.tf b/modules/gh/versions.tf index fbe53be..bcf6c0e 100644 --- a/modules/gh/versions.tf +++ b/modules/gh/versions.tf @@ -1,7 +1,8 @@ terraform { required_providers { github = { - source = "integrations/github" + source = "integrations/github" + version = "~> 5.45.0" } } } diff --git a/modules/kms/main.tf b/modules/kms/main.tf index 13ce9e6..71ea116 100644 --- a/modules/kms/main.tf +++ b/modules/kms/main.tf @@ -1,5 +1,6 @@ module "kms" { - source = "terraform-google-modules/kms/google" + source = "terraform-google-modules/kms/google" + version = "~> 2.3.0" project_id = var.project_id location = var.location diff --git a/versions.tf b/versions.tf index b7e4073..98588f1 100644 --- a/versions.tf +++ b/versions.tf @@ -1,10 +1,12 @@ terraform { required_providers { google = { - source = "hashicorp/google" + source = "hashicorp/google" + version = "~> 5.15.0" } random = { - source = "hashicorp/random" + source = "hashicorp/random" + version = "~> 3.6.0" } } }