Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metadata.terraform_workspace_pattern #138

Merged
merged 6 commits into from Apr 18, 2022
Merged

Add metadata.terraform_workspace_pattern #138

merged 6 commits into from Apr 18, 2022

Conversation

aknysh
Copy link
Member

@aknysh aknysh commented Apr 17, 2022

what

  • Add metadata.terraform_workspace_pattern

why

  • We already have metadata.terraform_workspace using which we can specify/override the terraform workspace for a component
  • metadata.terraform_workspace_pattern introduces a pattern to override a terraform workspace for a component
      metadata:
        # Override Terraform workspace
        terraform_workspace: xxxxxxxxxxxxxxx
        terraform_workspace_pattern: "{tenant}-{environment}-{stage}-{component}"
  • The following tokens are supported in metadata.terraform_workspace_pattern:

    • {namespace}
    • {tenant}
    • {environment}
    • {stage}
    • {component}
    • {base-component}
  • This is useful to when converting YAML stack configs from the old atmos based on variant. In he old atmos, when a component: xxx attribute was specified for a component, it was considered as base component even if it was the same as the YAML component itself, in which case the terraform workspace for the component was calculated as <environment>-<stage>-<component>. The new atmos does not consider the same name for the component: attribute as a base component, which leads to the terraform workspace <environment>-<stage> (and hence Terraform not seeing the old workspace and wanting to re-create the component. To fix it, add terraform_workspace_pattern: "{environment}-{stage}-{component}" to the component's metadata

@aknysh aknysh added the patch A minor, backward compatible change label Apr 17, 2022
@aknysh aknysh self-assigned this Apr 17, 2022
@aknysh aknysh requested review from a team as code owners April 17, 2022 04:59
pkg/config/utils.go Outdated Show resolved Hide resolved
@aknysh aknysh requested a review from mcalhoun April 17, 2022 14:01
Copy link
Member

@mcalhoun mcalhoun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@aknysh aknysh merged commit 803ec0f into master Apr 18, 2022
@aknysh aknysh deleted the update-15 branch April 18, 2022 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch A minor, backward compatible change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants