-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Feature request] Dynamically generate repo atlantis.yaml config #500
Comments
I think something like buildkite has (https://buildkite.com/docs/pipelines/defining-steps#dynamic-pipelines) where you can have a As written above, it's not at all secure, but then it's just as secure as an atlantis.yaml (at the moment). I think there's some mitigations we could have once the server-side config lands. |
I think doing the This feature will definitely open up to a bunch of security concerns, so we will have to balance that together with the upcoming server-side configs. |
I was trying to approach this with a pre-commit git-hook, but it doesn't scale across the team properly. Might there any other possible intermediate solutions or workarounds?
What do you use as a trigger for your script? @lkysow In case of using Atlantis with Gitlab, is it possible somehow to execute own Gitbal CI pipeline before Atlantis will run its own? |
Seems, I was able to find workaround for updating atlantis.yaml at least during auto-plan phase. My workaround is based on
Not sure that my workaround is valid/legit though. I'll test it more. |
Hello team, |
I think the direction I'd like to go here is a server-side config that lets you specify a script to run for each repo id that will generate the repo-level atlantis.yaml that then gets parsed. repos:
- id: your-repo
repo_config:
- run: ./my-script
- run: |
my bash script inline |
I managed to proceed with a solution with PS. |
Hello friends, I just found out that @msarvar have created a proper PR to add such functionality but i believe that till then you can take advantage of the workaround method that we are currently using. cc. @dmattia @mechastorm |
@angeloskaltsikis I found your post extremely helpful in getting multi-account terragrunt working with atlantis. I have switched to using @msarvar 's pre workflow hook though it doesn't run when |
Orqa 447 add server configuration to run prehooks. |
Isn't this already supported? At the moment, you can generate the atlantis.yaml from a pre-workflow-run and atlantis will read it on the fly before determining which projects to plan. Please correct me if I'm mistaken and this can be reopened. |
Do you mean this: That script is not included with Atlantis itself AFAIK. Example: pre_workflow_hooks:
- run: >
terragrunt-atlantis-config generate --output ./atlantis.yaml
--autoplan --automerge --parallel --create-workspace |
As noted by @nitrocode, this feature is already available in the pre-workflow-run stage. To address our requirements, we've developed an atlantis-yaml-generator tool designed for GitHub projects. This tool seamlessly integrates into the pre-workflow-run stage and dynamically creates the atlantis.yaml file. It specifically generates projects that are pertinent to the changes made in the pull request. In cases of monorepos, when your PR impacts just one project, there's no need for Atlantis to run on all the projects. You can also exclude some project via regex filtering. Thanks again to all atlantis contributors for this project!! Sample usage:
Files changed in the PR:
It will render this atlantis.yaml file:
|
I am looking at way to better maintain our
atlantis.yml
on monolith repos. In some repositories I encounter, we have >500 terraform directories. Each directory is defined as a unique project stanza. This is because each directory needs to be assigned a predefined workflow. Example a TF directory atterraform/myservice/prod
should use theproduction
workflow. All of this creates anatlantis.yml
that is >5000 lines at times. And it will only grow larger.I am working on a script to automatically generate a new
atlantis.yml
config each time a new directory is detected / added. But the workflow to integrate this generatedatlantis.yml
in version control could get complicated.The one idea is to allow Atlantis run arbitary command/script before it reads the
atlantis.yml
. I think that would be the best to insert any automation script needed by Atlantis including generating an updateatlantis.yml
file.I am also open to any other suggetions on how we can better maintain our
atlantis.yaml
for a large monolith repo.The text was updated successfully, but these errors were encountered: