Repository navigation
Update and enhance Atlantis Integration - #328
Conversation
Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>
Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>
Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>
Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>
Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>
Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>
Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>
Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>
Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>
Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>
| # https://www.runatlantis.io/docs/custom-workflows.html#custom-run-command | ||
| workflow_templates: | ||
| workflow-1: | ||
| plan: |
There was a problem hiding this comment.
Does plan support the env key for arbitrary environment variables?
There was a problem hiding this comment.
i'm not sure I'm following, can you provide an example of that?
(the workflows configs are just copied to the atlantis.yaml file verbatim if you use the repo level workflows)
There was a problem hiding this comment.
Oh ok so something like this would work then since atlantis supports? That means that this object is now an any?
workflow_templates:
workflow-1:
plan:
steps:
- env:
name: ENV_NAME
value: hard-coded-value
- env:
name: ENV_NAME_2
command: 'echo "dynamic-value-$(date)"'If so, perfect :)
There was a problem hiding this comment.
atmos does not touch the internals of the workflows definitions. You can def use any ENV vars in there that are set in the process (atmos does not check what's inside the workflows and does not set any ENV vars for it)
|
I skimmed the code. Looks okay to me. Might help if PePe Amengual (@jamengual) looks it over too. I'll read over the docs today and submit a review |
PePe Amengual (@jamengual) approved it a few days ago :) |
what
--formatand--fileflags toatmos describe componentcommandwhy
Allow configuring Atlantis Integration in the
settings.atlantissection in the YAML stack configs (instead, or in addition to, configuring it inintegrations.atlantisinatmos.yaml)Configuring the Atlantis Integration in the
settings.atlantissections in the stack configs has the following advantages:The
settingssection is a first class section in Atmos (similar tovars). It participates in deep-merging and in the inheritance chain. It can be defined and overridden at any level (organization/namespace, OU/tenant, region/environment, account/stage, base component, component). You can define the base settings at the org, tenant or account level, and then override some settings at the component level, making the whole configuration DRYWhen executing the
atmos atlantis generate repo-configcommand, you don't need to pass the--config-templateand--project-templateflags to specify which config and project templates to use. Instead, Atmos will get this information from thesettings.atlantissectionWhen executing the
atmos describe component <component> -s <stack>command, you will see the configured Atlantis Integration in the outputs. For example:If you configure the Atlantis Integration in the
settings.atlantissections in the stack configs, then thecommand
atmos describe affectedwill be able to use it and output the affected Atlantis projects in theatlantis_projectfield. For example:[ { "component": "infra/vpc", "component_type": "terraform", "component_path": "components/terraform/infra/vpc", "stack": "tenant1-ue2-dev", "atlantis_project": "tenant1-ue2-dev-infra-vpc", "affected": "component" }, { "component": "infra/vpc", "component_type": "terraform", "component_path": "components/terraform/infra/vpc", "stack": "tenant1-ue2-prod", "atlantis_project": "tenant1-ue2-prod-infra-vpc", "affected": "component" } ]Add
--affected-onlyflag toatmos atlantis generate repo-configcommandIf you want to generate the
atlantis.yamlfile before Atlantis can parse it, you can use the Dynamic Repo Config Generation feature of Atlantis. You can add aruncommand topre_workflow_hooks. The repo config will be generated right before Atlantis can parse it.To help with dynamic repo config generation, the
atmos atlantis generate repo-configcommand accepts the--affected-onlyflag. If set totrue, Atmos will generate Atlantis projects only for the Atmos components changed between two Git commits.If the
--affected-only=trueflag is passed, Atmos uses two different Git commits to produce a list of affected Atmos components and stacks and then generate theatlantis.yamlfile for the affected Atlantis projects only.Update
atmos describe affectedcommand to include theatlantis_projectattribute in the output of the affected components and stacks. The attribute shows the affected Atlantis projects between two diff Git commits (Note that this works only when Atlantis integration is configured in thesettings.atlantissections in the YAML stack config (see the description above)[ { "component": "infra/vpc", "component_type": "terraform", "component_path": "components/terraform/infra/vpc", "stack": "tenant1-ue2-dev", "atlantis_project": "tenant1-ue2-dev-infra-vpc", "affected": "component" }, { "component": "infra/vpc", "component_type": "terraform", "component_path": "components/terraform/infra/vpc", "stack": "tenant1-ue2-prod", "atlantis_project": "tenant1-ue2-prod-infra-vpc", "affected": "component" } ]Add
--formatand--fileflags toatmos describe componentcommand - useful to have when working with the command in GitHub actions and OPA validationrelated
atmos describe affecteddoes not show the project name if the atlantis integration is enabled #294atmos atlantis generate repo-config --affected-only#303