https://github.com/mediapop/terraform-aws-utils
Utility functions for working around terraform limitations.
https://github.com/mediapop/terraform-aws-utils
Last synced: 3 months ago
JSON representation
Utility functions for working around terraform limitations.
- Host: GitHub
- URL: https://github.com/mediapop/terraform-aws-utils
- Owner: mediapop
- License: mit
- Created: 2018-07-20T10:42:54.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-07-20T12:38:08.000Z (almost 7 years ago)
- Last Synced: 2025-01-24T08:11:41.693Z (5 months ago)
- Language: HCL
- Size: 2.93 KB
- Stars: 0
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Terraform utils
*This terraform module is maintained by [Media Pop](https://www.mediapop.co), a software consultancy. Hire us to solve your DevOps challenges.*
Repackage awkward terraform hacks into generic modules.
# If then else
Works around for [conditional operator cannot be used with list values](https://github.com/hashicorp/terraform/issues/18259)
```hcllocals = {
use_good_letters = true
good_letters = "${list("a", "b")}"
bad_letters = "${list("c")}"
}module "letters_lookup" {
source = "mediapop/aws/utils/if"
if = "${local.use_good_letters}"
then = "${local.good_letters}"
else = "${local.bad_letters}"
}output "letters" {
value = "${module.letters_lookup.result}"
}
```## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| if | The condition. | string | - | yes |
| then | Value when true | list | - | yes |
| else | Value when false | list | - | yes |## Outputs
| Name | Description | Type |
|------|-------------|:----:|
| result | The result of the evaluation | any |