Slackbot
11/16/2023, 7:04 AMNicolai Stølen
11/16/2023, 8:15 AMatlantis plan -- -target=… , see
https://www.runatlantis.io/docs/using-atlantis.html#additional-terraform-flagsPriyashree Shetty
11/16/2023, 10:11 AMIlia Kovalev
11/16/2023, 10:51 AMworkflows:
terragrunt-default:
plan:
steps:
- run:
command: terragrunt init -input=false -upgrade
output: hide
- run:
command: terragrunt plan -input=false -lock=false $(printf '%s' $COMMENT_ARGS | sed 's/,/ /g' | tr -d '\\') -out $PLANFILE
output: hide
- run: terragrunt show -no-color -json $PLANFILE > $SHOWFILE
- run: terragrunt show $PLANFILE
policy_check:
steps:
- policy_check:
extra_args: ["-p", "/home/atlantis/policies/", "--all-namespaces", "--output=table", "--parser=json", "--no-color"]
apply:
steps:
- run: terragrunt apply -input=false $(printf '%s' $COMMENT_ARGS | sed 's/,/ /g' | tr -d '\\') $PLANFILE
import:
steps:
- env:
name: TF_VAR_author
command: 'git show -s --format="%ae" $HEAD_COMMIT'
- run: terragrunt import -input=false $(printf '%s' $COMMENT_ARGS | sed 's/,/ /' | tr -d '\\')
state_rm:
steps:
- run: terragrunt state rm $(printf '%s' $COMMENT_ARGS | sed 's/,/ /' | tr -d '\\')Ilia Kovalev
11/16/2023, 10:51 AMatlantis plan -- -targetPriyashree Shetty
11/16/2023, 11:02 AMIlia Kovalev
11/16/2023, 11:04 AMatlantis -plan --target and it will create planfile with your target, after that you can run atlantis apply without target flag since you have targeted plan already
but you can't instantly run atlantis apply -- -target because even with target flag it will apply the entire planfile, looks like terraform cant apply targeted plans 😞Priyashree Shetty
11/16/2023, 11:06 AMPriyashree Shetty
11/16/2023, 11:07 AMatlantis -plan --target it does a full plan currently. This may be due to not using the custom workflow as you mentioned aboveNicolai Stølen
11/16/2023, 11:08 AMatlantis plan -d some-directory -- -target=my-resourcePriyashree Shetty
11/16/2023, 11:09 AMatlantis plan -d some-directory -- -target=my-resource it still does a full planIlia Kovalev
11/16/2023, 11:09 AMIlia Kovalev
11/16/2023, 11:10 AMNicolai Stølen
11/16/2023, 11:10 AMPriyashree Shetty
11/16/2023, 11:11 AMversion: 3
projects:
- dir: providers/aws/us-east-1/dev
apply_requirements: [approved, mergeable]
terraform_version: v1.4.6
workspace: default
autoplan:
when_modified: ["*.tf", "backends/*.tf"]
workflow: tfversion1.4.6
- dir: providers/aws/us-east-1/test
apply_requirements: [approved, mergeable]
terraform_version: v1.4.6
workspace: default
autoplan:
when_modified: ["*.tf", "backends/*.tf", "frontends/*.tf"]
workflow: tfversion1.4.6
workflows:
tfversion1.4.6:
plan:
steps:
- run: /atlantis-data/bin/terraform1.4.6 init > /dev/null
- run: /atlantis-data/bin/terraform1.4.6 plan >/dev/null -out plan.out
- run: /atlantis-data/bin/terraform1.4.6 show plan.out
apply:
steps:
- run: /atlantis-data/bin/terraform1.4.6 apply "plan.out"Ilia Kovalev
11/16/2023, 11:12 AMtfversion1.4.6 workflow, so you can't pass the flags yetIlia Kovalev
11/16/2023, 11:12 AM-input=false -lock=false $(printf '%s' $COMMENT_ARGS | sed 's/,/ /g' | tr -d '\\') -out $PLANFILEIlia Kovalev
11/16/2023, 11:13 AMPriyashree Shetty
11/16/2023, 11:15 AM-lock=false is used then can multiple people plan and apply the same project ?Ilia Kovalev
11/16/2023, 11:17 AM-lock=false with plans because sometimes it locks the project because of errors, and yes multiple people can do some plans at the same time at the same project
but i don't recommend to use this in applyPriyashree Shetty
11/16/2023, 11:20 AMPriyashree Shetty
11/16/2023, 11:24 AMIlia Kovalev
11/16/2023, 11:25 AMPriyashree Shetty
11/16/2023, 11:27 AM$PLANFILE and $SHOWFILE ?Ilia Kovalev
11/16/2023, 11:28 AMPriyashree Shetty
11/16/2023, 11:29 AMIlia Kovalev
11/16/2023, 11:30 AM$PLANFILE and $SHOWFILEIlia Kovalev
11/16/2023, 11:30 AMPriyashree Shetty
11/16/2023, 11:30 AMyou didn't fix theI did not understand this question of yoursworkflow, so you can't pass the flags yettfversion1.4.6
Ilia Kovalev
11/16/2023, 11:31 AMtfversion1.4.6 there are no $(printf '%s' $COMMENT_ARGS | sed 's/,/ /g' | tr -d '\\')Ilia Kovalev
11/16/2023, 11:31 AMtarget flag with this workflowPriyashree Shetty
11/16/2023, 11:34 AMPriyashree Shetty
11/16/2023, 11:35 AMatlantis apply -- -target rightIlia Kovalev
11/16/2023, 11:35 AMIlia Kovalev
11/16/2023, 11:35 AMatlantis apply -- -targetPriyashree Shetty
11/16/2023, 11:39 AMIlia Kovalev
11/16/2023, 11:40 AM-lock=false flag
but i don't recommend to use it with applies because it potentially can lead to some disruptionsPriyashree Shetty
11/16/2023, 11:40 AMChastity Blackwell
11/16/2023, 2:21 PM-target as a matter of course; in general, if you're using that all the time, you probably need to split up your Terraform roots (or you have a lot of drift you need to clean up).Ilia Kovalev
11/16/2023, 2:25 PMChastity Blackwell
11/16/2023, 2:30 PMIlia Kovalev
11/16/2023, 2:32 PM