Skip to content

Commit 14d80d7

Browse files
feat: update TPG version constraints to allow 4.0 (#50)
* feat: update TPG version constraints to allow 4.0 * swap selflink to id Co-authored-by: bharathkkb <[email protected]>
1 parent a4614d1 commit 14d80d7

File tree

7 files changed

+37
-15
lines changed

7 files changed

+37
-15
lines changed

examples/simple_example/main.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
provider "google" {
18-
version = "~> 3.53"
19-
}
20-
2117
module "kms" {
2218
source = "../.."
2319
project_id = var.project_id
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Copyright 2021 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
terraform {
18+
required_providers {
19+
google = {
20+
source = "hashicorp/google"
21+
version = "~> 4.0"
22+
}
23+
}
24+
required_version = ">= 0.13"
25+
}

main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
locals {
18-
keys_by_name = zipmap(var.keys, var.prevent_destroy ? slice(google_kms_crypto_key.key[*].self_link, 0, length(var.keys)) : slice(google_kms_crypto_key.key_ephemeral[*].self_link, 0, length(var.keys)))
18+
keys_by_name = zipmap(var.keys, var.prevent_destroy ? slice(google_kms_crypto_key.key[*].id, 0, length(var.keys)) : slice(google_kms_crypto_key.key_ephemeral[*].id, 0, length(var.keys)))
1919
}
2020

2121
resource "google_kms_key_ring" "key_ring" {
@@ -27,7 +27,7 @@ resource "google_kms_key_ring" "key_ring" {
2727
resource "google_kms_crypto_key" "key" {
2828
count = var.prevent_destroy ? length(var.keys) : 0
2929
name = var.keys[count.index]
30-
key_ring = google_kms_key_ring.key_ring.self_link
30+
key_ring = google_kms_key_ring.key_ring.id
3131
rotation_period = var.key_rotation_period
3232

3333
lifecycle {
@@ -45,7 +45,7 @@ resource "google_kms_crypto_key" "key" {
4545
resource "google_kms_crypto_key" "key_ephemeral" {
4646
count = var.prevent_destroy ? 0 : length(var.keys)
4747
name = var.keys[count.index]
48-
key_ring = google_kms_key_ring.key_ring.self_link
48+
key_ring = google_kms_key_ring.key_ring.id
4949
rotation_period = var.key_rotation_period
5050

5151
lifecycle {

outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
output "keyring" {
1818
description = "Self link of the keyring."
19-
value = google_kms_key_ring.key_ring.self_link
19+
value = google_kms_key_ring.key_ring.id
2020

2121
# The grants are important to the key be ready to use.
2222
depends_on = [

test/setup/main.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
18-
provider "google" {
19-
version = "~> 3.0"
20-
}
21-
2217
module "project_ci_kms" {
2318
source = "terraform-google-modules/project-factory/google"
2419
version = "~> 10.0"

test/setup/versions.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,11 @@
1515
*/
1616

1717
terraform {
18-
required_version = ">= 0.12"
18+
required_version = ">= 0.13"
19+
required_providers {
20+
google = {
21+
source = "hashicorp/google"
22+
version = "~> 3.0"
23+
}
24+
}
1925
}

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ terraform {
2020

2121
google = {
2222
source = "hashicorp/google"
23-
version = "~> 3.53"
23+
version = ">= 3.53, < 5.0"
2424
}
2525
}
2626

0 commit comments

Comments
 (0)