Skip to content

Commit 55fb3f0

Browse files
authored
Merge pull request #6 from ingwarr/master
Add support for Terraform v0.12 #5
2 parents 6256d48 + 6371abc commit 55fb3f0

File tree

27 files changed

+223
-91
lines changed

27 files changed

+223
-91
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ and this project adheres to
88
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
99

1010
## [Unreleased]
11+
### CHANGED
12+
13+
- Upgraded for usage with terraform-0.12.x [#6]
14+
1115

1216
## [0.1.1] - 2019-06-14
1317

@@ -26,3 +30,4 @@ and this project adheres to
2630
[0.1.0]: https://github.com/terraform-google-modules/terraform-google-service-accounts/releases/tag/v0.1.0
2731
[#3]: https://github.com/terraform-google-modules/terraform-google-service-accounts/pull/3
2832
[#1]: https://github.com/terraform-google-modules/terraform-google-service-accounts/pull/1
33+
[#6]: https://github.com/terraform-google-modules/terraform-google-service-accounts/pull/6

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
ruby '2.5.3'
1616

1717
source 'https://rubygems.org/' do
18-
gem 'kitchen-terraform', '~> 4.8'
18+
gem 'kitchen-terraform', '~> 4.9'
1919
end

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ SHELL := /usr/bin/env bash
2121
# Docker build config variables
2222
CREDENTIALS_PATH ?= /cft/workdir/credentials.json
2323
DOCKER_ORG := gcr.io/cloud-foundation-cicd
24-
DOCKER_TAG_BASE_KITCHEN_TERRAFORM ?= 1.0.1
24+
DOCKER_TAG_BASE_KITCHEN_TERRAFORM ?= 2.3.0
2525
DOCKER_REPO_BASE_KITCHEN_TERRAFORM := ${DOCKER_ORG}/cft/kitchen-terraform:${DOCKER_TAG_BASE_KITCHEN_TERRAFORM}
2626

2727
# All is the first target in the file so it will get picked up when you just run 'make' on its own
@@ -30,7 +30,7 @@ all: check generate_docs
3030

3131
# Run all available linters
3232
.PHONY: check
33-
check: check_shell check_python check_golang check_terraform check_docker check_base_files test_check_headers check_headers check_trailing_whitespace
33+
check: check_shell check_python check_golang check_terraform check_base_files test_check_headers check_headers check_trailing_whitespace
3434

3535
# The .PHONY directive tells make that this isn't a real target and so
3636
# the presence of a file named 'check_shell' won't cause this target to stop
@@ -95,7 +95,7 @@ docker_run:
9595
-e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \
9696
-v $(CURDIR):/cft/workdir \
9797
${DOCKER_REPO_BASE_KITCHEN_TERRAFORM} \
98-
/bin/bash -c "source test/ci_integration.sh && setup_environment && exec /bin/bash"
98+
/bin/bash -c "cd /cft/workdir && source test/ci_integration.sh && setup_environment && exec /bin/bash"
9999

100100
.PHONY: docker_create
101101
docker_create:
@@ -105,7 +105,7 @@ docker_create:
105105
-e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \
106106
-v $(CURDIR):/cft/workdir \
107107
${DOCKER_REPO_BASE_KITCHEN_TERRAFORM} \
108-
/bin/bash -c "source test/ci_integration.sh && setup_environment && kitchen create"
108+
/bin/bash -c "cd /cft/workdir && source test/ci_integration.sh && setup_environment && kitchen create"
109109

110110
.PHONY: docker_converge
111111
docker_converge:
@@ -115,7 +115,7 @@ docker_converge:
115115
-e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \
116116
-v $(CURDIR):/cft/workdir \
117117
${DOCKER_REPO_BASE_KITCHEN_TERRAFORM} \
118-
/bin/bash -c "source test/ci_integration.sh && setup_environment && kitchen converge"
118+
/bin/bash -c "cd /cft/workdir && source test/ci_integration.sh && setup_environment && kitchen converge"
119119

120120
.PHONY: docker_verify
121121
docker_verify:
@@ -125,7 +125,7 @@ docker_verify:
125125
-e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \
126126
-v $(CURDIR):/cft/workdir \
127127
${DOCKER_REPO_BASE_KITCHEN_TERRAFORM} \
128-
/bin/bash -c "source test/ci_integration.sh && setup_environment && kitchen verify"
128+
/bin/bash -c "cd /cft/workdir && source test/ci_integration.sh && setup_environment && kitchen verify"
129129

130130
.PHONY: docker_destroy
131131
docker_destroy:
@@ -135,7 +135,7 @@ docker_destroy:
135135
-e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \
136136
-v $(CURDIR):/cft/workdir \
137137
${DOCKER_REPO_BASE_KITCHEN_TERRAFORM} \
138-
/bin/bash -c "source test/ci_integration.sh && setup_environment && kitchen destroy"
138+
/bin/bash -c "cd /cft/workdir && source test/ci_integration.sh && setup_environment && kitchen destroy"
139139

140140
.PHONY: test_integration_docker
141141
test_integration_docker:
@@ -145,4 +145,4 @@ test_integration_docker:
145145
-e GOOGLE_APPLICATION_CREDENTIALS=${CREDENTIALS_PATH} \
146146
-v $(CURDIR):/cft/workdir \
147147
${DOCKER_REPO_BASE_KITCHEN_TERRAFORM} \
148-
make test_integration
148+
/bin/bash -c "cd /cft/workdir && source test/ci_integration.sh && setup_environment && make test_integration"

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ The resources/services/activations/deletions that this module will create/trigge
1010
- two optional organization-level IAM bindings per service account, to enable the service accounts to create and manage Shared VPC networks
1111
- one optional service account key per service account
1212

13+
## Compatibility
14+
15+
This module is meant for use with Terraform 0.12. If you haven't [upgraded](https://www.terraform.io/upgrade-guides/0-12.html)
16+
and need a Terraform 0.11.x-compatible version of this module, the last released version intended for
17+
Terraform 0.11.x is [0.1.1](https://registry.terraform.io/modules/terraform-google-modules/service-accounts/google/0.1.1).
18+
1319
## Usage
1420

1521
Basic usage of this module is as follows:
@@ -67,7 +73,7 @@ These sections describe requirements for using this module.
6773

6874
The following dependencies must be available:
6975

70-
- [Terraform][terraform] v0.11
76+
- [Terraform][terraform] v0.12
7177
- [Terraform Provider for GCP][terraform-provider-gcp] plugin >= v2.0
7278

7379
### IAM

examples/multiple_service_accounts/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ provider "google" {
2020

2121
module "service_accounts" {
2222
source = "../.."
23-
project_id = "${var.project_id}"
23+
project_id = var.project_id
2424
prefix = ""
2525
names = ["test-first", "test-second"]
2626
generate_keys = true
@@ -30,3 +30,4 @@ module "service_accounts" {
3030
"${var.project_id}=>roles/storage.objectViewer",
3131
]
3232
}
33+

examples/multiple_service_accounts/outputs.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@
1616

1717
output "emails" {
1818
description = "The service account emails."
19-
value = "${values(module.service_accounts.emails)}"
19+
value = values(module.service_accounts.emails)
2020
}
2121

2222
output "iam_emails" {
2323
description = "The service account IAM-format emails."
24-
value = "${values(module.service_accounts.iam_emails)}"
24+
value = values(module.service_accounts.iam_emails)
2525
}
2626

2727
output "keys" {
2828
description = "The service account keys."
29-
value = "${module.service_accounts.keys}"
29+
value = module.service_accounts.keys
3030
}
31+

examples/multiple_service_accounts/variables.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616

1717
variable "project_id" {
1818
description = "The ID of the project in which to provision resources."
19-
type = "string"
19+
type = string
2020
}
21+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Copyright 2019 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_version = ">= 0.12"
19+
}

examples/single_service_account/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ provider "google" {
2020

2121
module "service_accounts" {
2222
source = "../.."
23-
project_id = "${var.project_id}"
24-
prefix = "${var.prefix}"
23+
project_id = var.project_id
24+
prefix = var.prefix
2525
names = ["single-account"]
2626
project_roles = ["${var.project_id}=>roles/viewer"]
2727
}
28+

examples/single_service_account/outputs.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616

1717
output "email" {
1818
description = "The service account email."
19-
value = "${module.service_accounts.email}"
19+
value = module.service_accounts.email
2020
}
2121

2222
output "iam_email" {
2323
description = "The service account IAM-format email."
24-
value = "${module.service_accounts.iam_email}"
24+
value = module.service_accounts.iam_email
2525
}
26+

0 commit comments

Comments
 (0)