Today I ran a plan for 2 targets and that worked f...
# atlantis-community
s
Today I ran a plan for 2 targets and that worked fine. I was then able to apply them also…
atlantis plan -d service/thing -w dev -- -target=aws_instance.instance_1 -target=aws_instance.instance_2
✅
atlantis apply -d service/thing -w dev -- -target=aws_instance.instance_1 -target=aws_instance.instance_2
✅ But if I run a
replace
command, Atlantis wants to replace everything that “must be replaced” and not just the two instances im pointing at. My replace command looks like this:
atlantis plan -d service/thing -w dev -- -replace=aws_instance.instance_1 -replace=aws_instance.instance_2
What am I missing here?
p
if you do this in pure TF does this work?
manually
s
I think i figured out whats going on. To answer your question yes, I was able to in my test repo and state. But not Im trying to do it in my actual repo with live instances. There are instances where the configs have changed so those would be seen by plan/apply. When you used to do a
taint
you would taint the one or more resources, then you could run a targetd plan/apply against just that one resource. Now with the
replace
command you use that flag in an apply command. But since there are other resources that are expecting changes those show up in the plan/apply as well. TLDR; theres not a way to do a “targeted replace” you just name the resource you want to replace and atlantis will include that in its plan/apply with any other resources that are expecting changes. #ThatSucks
The
taint
command was depped and replaced with the
replace
command but it actually doesnt work the same.
p
but this is not an Atlantis problem , right ? if this happens with pure terraform , then it is not
s
Correct
p
ok, thanks for the update and detailed answer
s
Its a Hashicorp changed the fundamentals of how a commands works when they deprecated it problem.