Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

Commit 372aae4

Browse files
authored
Merge pull request #224 from hashicorp/tf13
Update repo to work with TF 0.13
2 parents 75e9d10 + c7e5121 commit 372aae4

File tree

22 files changed

+114
-93
lines changed

22 files changed

+114
-93
lines changed

.circleci/config.yml

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,25 @@
11
---
2-
workspace_root: &workspace_root /go/src/github.com/hashicorp/terraform-aws-vault
3-
42
defaults: &defaults
5-
working_directory: *workspace_root
63
docker:
7-
- image: 087285199408.dkr.ecr.us-east-1.amazonaws.com/circle-ci-test-image-base:go1.13
4+
- image: 087285199408.dkr.ecr.us-east-1.amazonaws.com/circle-ci-test-image-base:tf13.4
85

96
version: 2
107
jobs:
11-
validate_terraform:
12-
docker:
13-
- image: hashicorp/terraform
14-
steps:
15-
- checkout
16-
- run:
17-
name: Validate Terraform Formatting
18-
command: '[ -z "$(terraform fmt -write=false)" ] || { terraform fmt -write=false -diff; exit 1; }'
19-
208
test:
219
<<: *defaults
2210
steps:
2311
- checkout
2412
- run: echo 'export PATH=$HOME/terraform:$HOME/packer:$PATH' >> $BASH_ENV
2513
# Domain name of Route 53 hosted zone to use at test time
2614
- run: echo 'export VAULT_HOSTED_ZONE_DOMAIN_NAME=gruntwork.in' >> $BASH_ENV
27-
- attach_workspace:
28-
at: *workspace_root
15+
- run:
16+
# Fail the build if the pre-commit hooks don't pass. Note: if you run $ pre-commit install locally within this repo, these hooks will
17+
# execute automatically every time before you commit, ensuring the build never fails at this step!
18+
name: run pre-commit hooks
19+
command: |
20+
pip install pre-commit==1.21.0 cfgv==2.0.1
21+
pre-commit install
22+
pre-commit run --all-files
2923
- run:
3024
command: |
3125
mkdir -p /tmp/logs
@@ -50,18 +44,14 @@ jobs:
5044
# We generally only want to build AMIs on new releases, but when we are setting up AMIs in a new account for the
5145
# first time, we want to build the AMIs but NOT run automated tests, since those tests will fail without an existing
5246
# AMI already in the AWS Account.
53-
- run: /go/src/github.com/hashicorp/terraform-aws-vault/_ci/publish-amis.sh "ubuntu16-ami"
54-
- run: /go/src/github.com/hashicorp/terraform-aws-vault/_ci/publish-amis.sh "ubuntu18-ami"
55-
- run: /go/src/github.com/hashicorp/terraform-aws-vault/_ci/publish-amis.sh "amazon-linux-2-ami"
47+
- run: _ci/publish-amis.sh "ubuntu16-ami"
48+
- run: _ci/publish-amis.sh "ubuntu18-ami"
49+
- run: _ci/publish-amis.sh "amazon-linux-2-ami"
5650

5751
workflows:
5852
version: 2
5953
build-and-test:
6054
jobs:
61-
- validate_terraform:
62-
filters:
63-
branches:
64-
ignore: publish-amis
6555
- test:
6656
filters:
6757
branches:
@@ -81,5 +71,4 @@ workflows:
8171
only:
8272
- master
8373
jobs:
84-
- validate_terraform
8574
- test

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
repos:
2+
- repo: https://github.com/gruntwork-io/pre-commit
3+
rev: v0.1.10
4+
hooks:
5+
- id: terraform-fmt
6+
- id: gofmt

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,8 @@ To deploy the Vault cluster:
5757
module](https://github.com/hashicorp/terraform-aws-consul/tree/master/modules/install-consul)). Here is an
5858
[example Packer template](https://github.com/hashicorp/terraform-aws-vault/tree/master/examples/vault-consul-ami).
5959

60-
If you are just experimenting with this Module, you may find it more convenient to use one of our official public AMIs:
61-
- [Latest Ubuntu 16 AMIs](https://github.com/hashicorp/terraform-aws-vault/tree/master/_docs/ubuntu16-ami-list.md).
62-
- [Latest Amazon Linux 2 AMIs](https://github.com/hashicorp/terraform-aws-vault/tree/master/_docs/amazon-linux-ami-list.md).
60+
If you are just experimenting with this Module, you may find it more convenient to use one of our official public AMIs.
61+
Check out the `aws_ami` data source usage in `main.tf` for how to auto-discover this AMI.
6362

6463
**WARNING! Do NOT use these AMIs in your production setup. In production, you should build your own AMIs in your
6564
own AWS account.**

_ci/publish-amis.sh

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1111
readonly PACKER_TEMPLATE_PATH="$SCRIPT_DIR/../examples/vault-consul-ami/vault-consul.json"
1212
readonly PACKER_TEMPLATE_DEFAULT_REGION="us-east-1"
1313
readonly AMI_PROPERTIES_FILE="/tmp/ami.properties"
14-
readonly AMI_LIST_MARKDOWN_DIR="$SCRIPT_DIR/../_docs"
15-
readonly GIT_COMMIT_MESSAGE="Add latest AMI IDs."
16-
readonly GIT_USER_NAME="gruntwork-ci"
17-
readonly GIT_USER_EMAIL="ci@gruntwork.io"
1814

1915
# In CircleCI, every build populates the branch name in CIRCLE_BRANCH...except builds triggered by a new tag, for which
2016
# the CIRCLE_BRANCH env var is empty. We assume tags are only issued against the master branch.
@@ -55,15 +51,5 @@ publish-ami \
5551
--all-regions \
5652
--source-ami-id "$ARTIFACT_ID" \
5753
--source-ami-region "$PACKER_TEMPLATE_DEFAULT_REGION" \
58-
--output-markdown > "$AMI_LIST_MARKDOWN_DIR/$PACKER_BUILD_NAME-list.md" \
5954
--markdown-title-text "$PACKER_BUILD_NAME: Latest Public AMIs" \
6055
--markdown-description-text "**WARNING! Do NOT use these AMIs in a production setting.** They contain TLS certificate files that are publicly available through this repo and using these AMIs in production would represent a serious security risk. The AMIs are meant only to make initial experiments with this module more convenient."
61-
62-
# Git add, commit, and push the newly created AMI IDs as a markdown doc to the repo
63-
git-add-commit-push \
64-
--path "$AMI_LIST_MARKDOWN_DIR/$PACKER_BUILD_NAME-list.md" \
65-
--message "$GIT_COMMIT_MESSAGE" \
66-
--user-name "$GIT_USER_NAME" \
67-
--user-email "$GIT_USER_EMAIL" \
68-
--git-push-behavior "current" \
69-
--branch-name "$BRANCH_NAME"

examples/vault-agent/main.tf

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# ----------------------------------------------------------------------------------------------------------------------
22
# REQUIRE A SPECIFIC TERRAFORM VERSION OR HIGHER
3-
# This module has been updated with 0.12 syntax, which means it is no longer compatible with any versions below 0.12.
43
# ----------------------------------------------------------------------------------------------------------------------
54
terraform {
6-
required_version = ">= 0.12"
5+
# This module is now only being tested with Terraform 0.13.x. However, to make upgrading easier, we are setting
6+
# 0.12.26 as the minimum version, as that version added support for required_providers with source URLs, making it
7+
# forwards compatible with 0.13.x code.
8+
required_version = ">= 0.12.26"
79
}
810

911
# ---------------------------------------------------------------------------------------------------------------------
@@ -59,7 +61,7 @@ data "aws_iam_policy_document" "example_instance_role" {
5961

6062
# Adds policies necessary for running consul
6163
module "consul_iam_policies_for_client" {
62-
source = "github.com/hashicorp/terraform-aws-consul.git//modules/consul-iam-policies?ref=v0.7.7"
64+
source = "github.com/hashicorp/terraform-aws-consul.git//modules/consul-iam-policies?ref=v0.8.0"
6365

6466
iam_role_id = aws_iam_role.example_instance_role.id
6567
}
@@ -168,7 +170,7 @@ module "vault_cluster" {
168170
# ---------------------------------------------------------------------------------------------------------------------
169171

170172
module "consul_iam_policies_servers" {
171-
source = "github.com/hashicorp/terraform-aws-consul.git//modules/consul-iam-policies?ref=v0.7.7"
173+
source = "github.com/hashicorp/terraform-aws-consul.git//modules/consul-iam-policies?ref=v0.8.0"
172174

173175
iam_role_id = module.vault_cluster.iam_role_id
174176
}
@@ -199,7 +201,7 @@ data "template_file" "user_data_vault_cluster" {
199201
# ---------------------------------------------------------------------------------------------------------------------
200202

201203
module "security_group_rules" {
202-
source = "github.com/hashicorp/terraform-aws-consul.git//modules/consul-client-security-group-rules?ref=v0.7.7"
204+
source = "github.com/hashicorp/terraform-aws-consul.git//modules/consul-client-security-group-rules?ref=v0.8.0"
203205

204206
security_group_id = module.vault_cluster.security_group_id
205207

@@ -214,7 +216,7 @@ module "security_group_rules" {
214216
# ---------------------------------------------------------------------------------------------------------------------
215217

216218
module "consul_cluster" {
217-
source = "github.com/hashicorp/terraform-aws-consul.git//modules/consul-cluster?ref=v0.7.7"
219+
source = "github.com/hashicorp/terraform-aws-consul.git//modules/consul-cluster?ref=v0.8.0"
218220

219221
cluster_name = var.consul_cluster_name
220222
cluster_size = var.consul_cluster_size

examples/vault-auto-unseal/main.tf

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# ----------------------------------------------------------------------------------------------------------------------
22
# REQUIRE A SPECIFIC TERRAFORM VERSION OR HIGHER
3-
# This module has been updated with 0.12 syntax, which means it is no longer compatible with any versions below 0.12.
43
# ----------------------------------------------------------------------------------------------------------------------
54
terraform {
6-
required_version = ">= 0.12"
5+
# This module is now only being tested with Terraform 0.13.x. However, to make upgrading easier, we are setting
6+
# 0.12.26 as the minimum version, as that version added support for required_providers with source URLs, making it
7+
# forwards compatible with 0.13.x code.
8+
required_version = ">= 0.12.26"
79
}
810

911
data "aws_kms_alias" "vault-example" {
@@ -53,7 +55,7 @@ module "vault_cluster" {
5355
# ---------------------------------------------------------------------------------------------------------------------
5456

5557
module "consul_iam_policies_servers" {
56-
source = "github.com/hashicorp/terraform-aws-consul.git//modules/consul-iam-policies?ref=v0.7.7"
58+
source = "github.com/hashicorp/terraform-aws-consul.git//modules/consul-iam-policies?ref=v0.8.0"
5759

5860
iam_role_id = module.vault_cluster.iam_role_id
5961
}
@@ -81,7 +83,7 @@ data "template_file" "user_data_vault_cluster" {
8183
# ---------------------------------------------------------------------------------------------------------------------
8284

8385
module "security_group_rules" {
84-
source = "github.com/hashicorp/terraform-aws-consul.git//modules/consul-client-security-group-rules?ref=v0.7.7"
86+
source = "github.com/hashicorp/terraform-aws-consul.git//modules/consul-client-security-group-rules?ref=v0.8.0"
8587

8688
security_group_id = module.vault_cluster.security_group_id
8789

@@ -96,7 +98,7 @@ module "security_group_rules" {
9698
# ---------------------------------------------------------------------------------------------------------------------
9799

98100
module "consul_cluster" {
99-
source = "github.com/hashicorp/terraform-aws-consul.git//modules/consul-cluster?ref=v0.7.7"
101+
source = "github.com/hashicorp/terraform-aws-consul.git//modules/consul-cluster?ref=v0.8.0"
100102

101103
cluster_name = var.consul_cluster_name
102104
cluster_size = var.consul_cluster_size

examples/vault-cluster-private/main.tf

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# ----------------------------------------------------------------------------------------------------------------------
22
# REQUIRE A SPECIFIC TERRAFORM VERSION OR HIGHER
3-
# This module has been updated with 0.12 syntax, which means it is no longer compatible with any versions below 0.12.
43
# ----------------------------------------------------------------------------------------------------------------------
54
terraform {
6-
required_version = ">= 0.12"
5+
# This module is now only being tested with Terraform 0.13.x. However, to make upgrading easier, we are setting
6+
# 0.12.26 as the minimum version, as that version added support for required_providers with source URLs, making it
7+
# forwards compatible with 0.13.x code.
8+
required_version = ">= 0.12.26"
79
}
810

911
# ---------------------------------------------------------------------------------------------------------------------
@@ -43,7 +45,7 @@ module "vault_cluster" {
4345
# ---------------------------------------------------------------------------------------------------------------------
4446

4547
module "consul_iam_policies_servers" {
46-
source = "github.com/hashicorp/terraform-aws-consul.git//modules/consul-iam-policies?ref=v0.7.7"
48+
source = "github.com/hashicorp/terraform-aws-consul.git//modules/consul-iam-policies?ref=v0.8.0"
4749

4850
iam_role_id = module.vault_cluster.iam_role_id
4951
}
@@ -70,7 +72,7 @@ data "template_file" "user_data_vault_cluster" {
7072
# ---------------------------------------------------------------------------------------------------------------------
7173

7274
module "security_group_rules" {
73-
source = "github.com/hashicorp/terraform-aws-consul.git//modules/consul-client-security-group-rules?ref=v0.7.7"
75+
source = "github.com/hashicorp/terraform-aws-consul.git//modules/consul-client-security-group-rules?ref=v0.8.0"
7476

7577
security_group_id = module.vault_cluster.security_group_id
7678

@@ -85,7 +87,7 @@ module "security_group_rules" {
8587
# ---------------------------------------------------------------------------------------------------------------------
8688

8789
module "consul_cluster" {
88-
source = "github.com/hashicorp/terraform-aws-consul.git//modules/consul-cluster?ref=v0.7.7"
90+
source = "github.com/hashicorp/terraform-aws-consul.git//modules/consul-cluster?ref=v0.8.0"
8991

9092
cluster_name = var.consul_cluster_name
9193
cluster_size = var.consul_cluster_size

examples/vault-consul-ami/vault-consul.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"variables": {
44
"aws_region": "us-east-1",
55
"vault_version": "1.5.4",
6-
"consul_module_version": "v0.7.3",
6+
"consul_module_version": "v0.8.0",
77
"consul_version": "1.5.3",
88
"consul_download_url": "{{env `CONSUL_DOWNLOAD_URL`}}",
99
"vault_download_url": "{{env `VAULT_DOWNLOAD_URL`}}",

examples/vault-dynamodb-backend/dynamodb/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
terraform {
2+
# This module is now only being tested with Terraform 0.13.x. However, to make upgrading easier, we are setting
3+
# 0.12.26 as the minimum version, as that version added support for required_providers with source URLs, making it
4+
# forwards compatible with 0.13.x code.
5+
required_version = ">= 0.12.26"
6+
}
7+
18
resource "aws_dynamodb_table" "vault_dynamo" {
29
name = var.table_name
310
hash_key = "Path"

examples/vault-dynamodb-backend/main.tf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# ----------------------------------------------------------------------------------------------------------------------
22
# REQUIRE A SPECIFIC TERRAFORM VERSION OR HIGHER
3-
# This module has been updated with 0.12 syntax, which means it is no longer compatible with any versions below 0.12.
43
# ----------------------------------------------------------------------------------------------------------------------
54
terraform {
6-
required_version = ">= 0.12"
5+
# This module is now only being tested with Terraform 0.13.x. However, to make upgrading easier, we are setting
6+
# 0.12.26 as the minimum version, as that version added support for required_providers with source URLs, making it
7+
# forwards compatible with 0.13.x code.
8+
required_version = ">= 0.12.26"
79
}
810

911
# ---------------------------------------------------------------------------------------------------------------------
@@ -43,7 +45,7 @@ module "vault_cluster" {
4345
ssh_key_name = var.ssh_key_name
4446

4547
enable_dynamo_backend = true
46-
dynamo_table_name = var.dynamo_table_name
48+
dynamo_table_name = var.dynamo_table_name
4749
}
4850

4951
data "template_file" "user_data_vault_cluster" {

0 commit comments

Comments
 (0)