cloudposse / cloudposse/atmos

Expose component, stack, and tf workspace as tags and `TF_VAR` env vars

Open
#226 5 comments 3 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
1.4k
Forks
175
Avg merge
2d 3h
Merged PRs (30d)
134

Description

Have a question? Please checkout our [Slack Community](https://slack.cloudposse.com) or visit our [Slack Archive](https://archive.sweetops.com/).

[![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)

## Describe the Feature

Expose component, stack, and tf workspace as TF_VAR env vars

I'd like to add TF_VAR inputs to receive the following env vars

```sh
TF_VAR_atmos_base_component
TF_VAR_atmos_component
TF_VAR_atmos_stack
TF_VAR_atmos_terraform_workspace
```

## Expected Behavior

For a base component of `eks/cluster` (`type: abstract`) and a component `eks-blue/cluster` (`type: real`) planned against `uw2-dev` should return the following values

```sh
TF_VAR_atmos_base_component=eks/cluster
TF_VAR_atmos_component=eks-blue/cluster
TF_VAR_atmos_stack=uw2-dev
TF_VAR_atmos_terraform_workspace=uw2-dev-eks-blue-cluster
```

For a component of `ecr` (`type: real`) without metadata using `type: abstract` and planned against `uw2-dev` should return the following values (or similar)

```sh
TF_VAR_atmos_base_component=ecr
TF_VAR_atmos_component=ecr
TF_VAR_atmos_stack=uw2-dev
TF_VAR_atmos_terraform_workspace=uw2-dev-ecr
```

It would be nice to append the tags input with the above as well

```yaml
tags:
ATMOS_BASE_COMPONENT: ecr
ATMOS_COMPONENT: ecr
ATMOS_STACK: uw2-dev
ATMOS_TERRAFORM_WORKSPACE: uw2-dev-ecr
```

## Use Case

I'd like to

- add the above information as tags
- create unique ssm parameters using the path `/atmos_stack/atmos_component/key`

## Describe Ideal Solution

using `TF_VAR` env vars

## Alternatives Considered

N/A

## Additional Context

N/A

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.