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
- Host: GitHub
- URL: https://github.com/rhythmictech/terraform-aws-ssm-parameter-lookup
- Owner: rhythmictech
- License: mit
- Created: 2024-02-12T16:30:49.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-02-12T16:42:15.000Z (over 2 years ago)
- Last Synced: 2026-02-12T09:47:33.217Z (4 months ago)
- Language: HCL
- Size: 5.86 KB
- Stars: 2
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
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.
[](https://github.com/rhythmictech/terraform-terraform-template/actions?query=workflow%3Atflint+event%3Apush+branch%3Amaster)
[](https://github.com/rhythmictech/terraform-terraform-template/actions?query=workflow%3Atfsec+event%3Apush+branch%3Amaster)
[](https://github.com/rhythmictech/terraform-terraform-template/actions?query=workflow%3Ayamllint+event%3Apush+branch%3Amaster)
[](https://github.com/rhythmictech/terraform-terraform-template/actions?query=workflow%3Amisspell+event%3Apush+branch%3Amaster)
[](https://github.com/rhythmictech/terraform-terraform-template/actions?query=workflow%3Apre-commit-check+event%3Apush+branch%3Amaster)

## 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.