Skip to content

Commit

Permalink
Merge pull request #17 from gruntwork-io/tf12
Browse files Browse the repository at this point in the history
Tf12 Upgrade
  • Loading branch information
yorinasub17 committed Jun 6, 2019
2 parents 68ed325 + d15e1c8 commit c008a10
Show file tree
Hide file tree
Showing 44 changed files with 623 additions and 290 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Expand Up @@ -15,7 +15,7 @@ jobs:
curl -Ls https://raw.githubusercontent.com/gruntwork-io/gruntwork-installer/master/bootstrap-gruntwork-installer.sh | bash /dev/stdin --version v0.0.21
gruntwork-install --module-name "gruntwork-module-circleci-helpers" --repo "https://github.com/gruntwork-io/module-ci" --tag "v0.13.3"
gruntwork-install --binary-name "terratest_log_parser" --repo "https://github.com/gruntwork-io/terratest" --tag "v0.13.20"
configure-environment-for-gruntwork-module --circle-ci-2 --use-go-dep --go-src-path test --terragrunt-version NONE
configure-environment-for-gruntwork-module --circle-ci-2 --use-go-dep --go-src-path test --terragrunt-version NONE --terraform-version 0.12.0
- run:
name: run tests (with python2)
Expand Down
12 changes: 9 additions & 3 deletions README.md
@@ -1,4 +1,6 @@
[![Maintained by Gruntwork.io](https://img.shields.io/badge/maintained%20by-gruntwork.io-%235849a6.svg)](https://gruntwork.io/?ref=repo_kubergrunt)
[![Maintained by Gruntwork.io](https://img.shields.io/badge/maintained%20by-gruntwork.io-%235849a6.svg)](https://gruntwork.io/?ref=repo_package_terraform_utilities)
[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/gruntwork-io/package-terraform-utilities.svg?label=latest)](https://github.com/gruntwork-io/package-terraform-utilities/releases/latest)
![Terraform Version](https://img.shields.io/badge/tf-%3E%3D0.12.0-blue.svg)

# Terraform Utility Modules

Expand All @@ -15,8 +17,6 @@ This repo provides a Gruntwork IaC Package and has the following folder structur

The following modules are available:

* [intermediate-variable](/modules/intermediate-variable): A simple module that returns as output the exact variables
you pass to it as inputs. This gives you a way to store intermediate values that contain interpolations.
* [join-path](/modules/join-path): This module can be used to join a list of given path parts into a single path that is
platform/operating system aware. **(This module requires Python)**
* [operating-system](/modules/operating-system): This module can be used to figure out what operating system is being
Expand All @@ -30,6 +30,12 @@ The following modules are available:
and runs them as an local-exec provisioner on a null_resource. PEX files are python executables that contain all the
requirements necessary to run the script. **(This module requires Python)**

The following modules were deprecated and removed:

* [intermediate-variable](/modules/intermediate-variable): This module has been superseded by [terraform local
values](https://www.terraform.io/docs/configuration/locals.html). To upgrade, switch usage of `intermediate-variable`
with `locals`.

Click on each module above to see its documentation. Head over to the [examples](/examples) folder for example usage.


Expand Down
19 changes: 0 additions & 19 deletions examples/intermediate-variable/README.md

This file was deleted.

35 changes: 0 additions & 35 deletions examples/intermediate-variable/main.tf

This file was deleted.

7 changes: 0 additions & 7 deletions examples/intermediate-variable/outputs.tf

This file was deleted.

7 changes: 0 additions & 7 deletions examples/intermediate-variable/vars.tf

This file was deleted.

4 changes: 4 additions & 0 deletions examples/join-path/main.tf
@@ -1,3 +1,7 @@
terraform {
required_version = ">= 0.12"
}

module "path" {
# When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you
# to a specific version of the modules, such as the following example:
Expand Down
2 changes: 1 addition & 1 deletion examples/join-path/outputs.tf
@@ -1,3 +1,3 @@
output "path" {
value = "${module.path.path}"
value = module.path.path
}
8 changes: 6 additions & 2 deletions examples/list-remove/main.tf
@@ -1,9 +1,13 @@
terraform {
required_version = ">= 0.12"
}

module "list_remove" {
# When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you
# to a specific version of the modules, such as the following example:
# source = "git::git@github.com:gruntwork-io/package-terraform-utilities.git//modules/list-remove?ref=v0.0.8"
source = "../../modules/list-remove"

original_list = ["${var.input_list}"]
items_to_remove = ["${var.items_to_remove}"]
original_list = var.input_list
items_to_remove = var.items_to_remove
}
4 changes: 2 additions & 2 deletions examples/list-remove/outputs.tf
@@ -1,7 +1,7 @@
output "output_list" {
value = "${module.list_remove.output_list}"
value = module.list_remove.output_list
}

output "output_list_as_csv" {
value = "${join(",", module.list_remove.output_list)}"
value = join(",", module.list_remove.output_list)
}
4 changes: 2 additions & 2 deletions examples/list-remove/variables.tf
@@ -1,9 +1,9 @@
variable "input_list" {
description = "The list of items from which you wish to remove items."
type = "list"
type = list(any)
}

variable "items_to_remove" {
description = "The list of items you wish to remove from the input_list."
type = "list"
type = list(any)
}
4 changes: 4 additions & 0 deletions examples/operating-system/main.tf
@@ -1,3 +1,7 @@
terraform {
required_version = ">= 0.12"
}

module "os" {
# When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you
# to a specific version of the modules, such as the following example:
Expand Down
4 changes: 2 additions & 2 deletions examples/operating-system/outputs.tf
@@ -1,7 +1,7 @@
output "os_name" {
value = "${module.os.name}"
value = module.os.name
}

output "path_separator" {
value = "${module.os.path_separator}"
value = module.os.path_separator
}
19 changes: 12 additions & 7 deletions examples/pex/main.tf
Expand Up @@ -4,6 +4,10 @@
# terraform in a portable manner that can work with multiple platforms and python versions.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

terraform {
required_version = ">= 0.12"
}

# Run the PEX binary as a local-exec provisioner on a null_resource.
module "pex_resource" {
# When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you
Expand All @@ -13,22 +17,22 @@ module "pex_resource" {

# Path components to each of the PEX binary
python2_pex_path_parts = [
"${path.module}",
path.module,
"sample-python-script",
"bin",
"sample_python_script_py27_env.pex",
]

python3_pex_path_parts = [
"${path.module}",
path.module,
"sample-python-script",
"bin",
"sample_python_script_py3_env.pex",
]

# Path components to the folder that holds the python modules for sample_python_script
pex_module_path_parts = [
"${path.module}",
path.module,
"sample-python-script",
]

Expand All @@ -45,22 +49,22 @@ module "pex_data" {

# Path components to each of the PEX binary
python2_pex_path_parts = [
"${path.module}",
path.module,
"sample-python-script",
"bin",
"sample_python_script_py27_env.pex",
]

python3_pex_path_parts = [
"${path.module}",
path.module,
"sample-python-script",
"bin",
"sample_python_script_py3_env.pex",
]

# Path components to the folder that holds the python modules for sample_python_script
pex_module_path_parts = [
"${path.module}",
path.module,
"sample-python-script",
]

Expand All @@ -72,6 +76,7 @@ module "pex_data" {

# Query parameter for the data source, that will be passed into the script in json format
command_query = {
"echo" = "${var.echo_string}"
"echo" = var.echo_string
}
}

4 changes: 2 additions & 2 deletions examples/pex/outputs.tf
@@ -1,9 +1,9 @@
output "command_echo" {
description = "For the pex data source, if successful, this will contain the echo string."
value = "${lookup(module.pex_data.result, "echo")}"
value = module.pex_data.result["echo"]
}

output "command_python_version" {
description = "Read out the python version that was used to run the PEX"
value = "${lookup(module.pex_data.result, "python_version_info")}"
value = module.pex_data.result["python_version_info"]
}
1 change: 1 addition & 0 deletions examples/pex/variables.tf
@@ -1,4 +1,5 @@
variable "echo_string" {
description = "This string will be echo'd back from the pex data source."
type = string
default = "Hello world!"
}
12 changes: 8 additions & 4 deletions examples/require-executable/main.tf
@@ -1,11 +1,15 @@
terraform {
required_version = ">= 0.12"
}

module "require_executables" {
# When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you
# to a specific version of the modules, such as the following example:
# source = "git::git@github.com:gruntwork-io/package-terraform-utilities.git//modules/require-executable?ref=v1.0.8"
source = "../../modules/require-executable"

required_executables = ["${var.required_executables}"]
error_message = "${var.error_message}"
required_executables = var.required_executables
error_message = var.error_message
}

# Conditional checking example
Expand All @@ -15,6 +19,6 @@ module "conditional_require_executables" {
# source = "git::git@github.com:gruntwork-io/package-terraform-utilities.git//modules/require-executable?ref=v1.0.8"
source = "../../modules/require-executable"

required_executables = ["${var.validate_bad_executable ? "this-executable-should-not-exist" : ""}"]
error_message = "${var.bad_executable_error_message}"
required_executables = [var.validate_bad_executable ? "this-executable-should-not-exist" : ""]
error_message = var.bad_executable_error_message
}
5 changes: 4 additions & 1 deletion examples/require-executable/variables.tf
Expand Up @@ -5,19 +5,22 @@

variable "required_executables" {
description = "A list of named executables that should exist on the OS PATH."
type = "list"
type = list(string)
}

variable "error_message" {
description = "Error message to show if the required executable is not found. This is printed for each executable that was not found. The module will make the following substitutions in the string: `__EXECUTABLE_NAME__` will become the name of the executable that was not found."
type = string
}

variable "validate_bad_executable" {
description = "Whether or not to validate the existence of a bad executable."
type = bool
default = false
}

variable "bad_executable_error_message" {
description = "Error message to show for bad_executable check."
type = string
default = ""
}

0 comments on commit c008a10

Please sign in to comment.