An open API service indexing awesome lists of open source software.

https://github.com/rhythmictech/terraform-aws-ssm-parameter-lookup

Lookup SSM parameter without failing on absence
https://github.com/rhythmictech/terraform-aws-ssm-parameter-lookup

Last synced: 3 months ago
JSON representation

Lookup SSM parameter without failing on absence

Awesome Lists containing this project

README

          

# terraform-aws-ssm-parameter-lookup

This module will search for an SSM parameter and return its value if found, or an empty string otherwise.

[![tflint](https://github.com/rhythmictech/terraform-terraform-template/workflows/tflint/badge.svg?branch=master&event=push)](https://github.com/rhythmictech/terraform-terraform-template/actions?query=workflow%3Atflint+event%3Apush+branch%3Amaster)
[![tfsec](https://github.com/rhythmictech/terraform-terraform-template/workflows/tfsec/badge.svg?branch=master&event=push)](https://github.com/rhythmictech/terraform-terraform-template/actions?query=workflow%3Atfsec+event%3Apush+branch%3Amaster)
[![yamllint](https://github.com/rhythmictech/terraform-terraform-template/workflows/yamllint/badge.svg?branch=master&event=push)](https://github.com/rhythmictech/terraform-terraform-template/actions?query=workflow%3Ayamllint+event%3Apush+branch%3Amaster)
[![misspell](https://github.com/rhythmictech/terraform-terraform-template/workflows/misspell/badge.svg?branch=master&event=push)](https://github.com/rhythmictech/terraform-terraform-template/actions?query=workflow%3Amisspell+event%3Apush+branch%3Amaster)
[![pre-commit-check](https://github.com/rhythmictech/terraform-terraform-template/workflows/pre-commit-check/badge.svg?branch=master&event=push)](https://github.com/rhythmictech/terraform-terraform-template/actions?query=workflow%3Apre-commit-check+event%3Apush+branch%3Amaster)
follow on Twitter

## About

Normally looking up a single parameter using the `aws_ssm_parameter` data source will fail if the parameter doesn't exist. Using the `aws_ssm_parameter_by_path` data source will not, but this is cumbersome in repetition. This module handles the cumbersome work for you and returns the value (optionally as insecure) or an empty string if not found.

## Requirements

No requirements.

## Providers

| Name | Version |
|------|---------|
| [aws](#provider\_aws) | n/a |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [aws_ssm_parameters_by_path.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssm_parameters_by_path) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [return\_insecure](#input\_return\_insecure) | Return an insecure value of the parameter | `bool` | `false` | no |
| [ssm\_parameter](#input\_ssm\_parameter) | Full path of the SSM parameter to return | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| [insecure\_value](#output\_insecure\_value) | n/a |
| [value](#output\_value) | n/a |

## Getting Started
This workflow has a few prerequisites which are installed through the `./bin/install-x.sh` scripts and are linked below. The install script will also work on your local machine.

- [pre-commit](https://pre-commit.com)
- [terraform](https://terraform.io)
- [tfenv](https://github.com/tfutils/tfenv)
- [terraform-docs](https://github.com/segmentio/terraform-docs)
- [tfsec](https://github.com/tfsec/tfsec)
- [tflint](https://github.com/terraform-linters/tflint)

We use `tfenv` to manage `terraform` versions, so the version is defined in the `versions.tf` and `tfenv` installs the latest compliant version.
`pre-commit` is like a package manager for scripts that integrate with git hooks. We use them to run the rest of the tools before apply.
`terraform-docs` creates the beautiful docs (above), `tfsec` scans for security no-nos, `tflint` scans for best practices.