We have repos with many projects that use terragru...
# atlantis-community
d
We have repos with many projects that use terragrunt-atlantis-config to generate the atlantis.yml. It works properly to plan only the projects that have changed (or depend on projects that have changed). Sometimes we want to apply "everything under environments/dev". I know that
-d
doesn't support regexps, but
-p
does. But when I run
atlantis apply -p environments_dev.*
it will try to apply every project with that name, not just those that autoplan decided should be planned. Is there a way to say "apply all projects/directories matching a given regexp, but only the ones that autoplan selected"?
p
so basically the apply command is trying to apply all the existing plans?
instead of the plans which project name/dir matches the regex?
d
so like.
atlantis apply
— applies every plan made by autoplan.
atlantis apply -p one-project
— applies that project
atlantis apply -p foo.*
applies every project with foo.* but i want "apply every plan that i actually made in the plan step (ie with autoplan, or the previous plan command, or whatever), filtered via foo.*"
another way of looking at it is, why should atlantis apply ever select a project that it doesn't have a plan for?
p
becaause of autoplan
if you do not use autoplan, this will not be a problem
d
well yes but autoplan is good 🙂
p
lol
d
isn't the whole workflow of atlantis "make a plan, then apply it"? how does
atlantis apply
without args work — is it recalculating the autoplan projects from scratch, or going based on what plans it already created?
p
plans already created
valid plans already created
d
right. so it's not unreasonable to want to have a command that says "apply a subset of plans already created, of size midway between 1 and all", no?
p
well that might not be a good thing sometimes
how do you then make sure your
main
branch is the source of truth if only a partial apply was run?
d
i mean atlantis lets you run a single project no?
p
ahhh yes true,
sorry I was thinking from the approvers side and such
d
the use case is like, i change a resource that terragrunt is installing in 3 different environments. i want to do dev first, see how it goes, then staging, then prod. easy enough, just use
atlantis apply -d/-p
on the single environment
ok now i'm changing 4 resources (of like 20) that TG is putting in 3 different envs
i'd like to do "the same thing" but i can't, i can only run 4 separate apply commands for each env
i think the answer might actually involves some of these TAG flags but i don't really understand what they are for https://github.com/transcend-io/terragrunt-atlantis-config?tab=readme-ov-file#project-generation
p
to create project names in the autogenerated atlantis.yaml file
do all your definitions in the generated atlantis.yaml have a project name?
d
they do if you pass the --generate-project-name flag so now they do
p
mmm