https://www.runatlantis.io/ logo
Title
p

Priyashree Shetty

04/11/2023, 11:13 AM
Hi Team. How is the initial auto plan when the PR is created differs from the
atlantis plan -d .
? Because when I create the PR I am able to see the plan result on my PR. If I comment
atlantis plan -d .
/`atlantis apply -d .` it does not work.
j

Jason Reslock

04/11/2023, 1:28 PM
This depends on what you have configured in
atlantis.yaml
at the root of the repo and it also depends on where
.
refers to in the repo. I will assume in this case it is the repo root. I highly doubt that you have .tf files at the root of your repository and that is likely why you see no plan output in the PR comments when specifying
.
as the target directory for your plan. To force a plan on a specific directory you can `atlantis plan -d terraform/environments/my_env`or similar, depending on where your .tf files are.
p

Priyashree Shetty

04/11/2023, 5:01 PM
1. My repo folder is /atlantis-repo on my local computer where there is a main.tf file which has the following code
resource "null_resource" "example1"{

}
2. I have deployed atlantis using helm chart. So I did not create atlantis.yml file in the root of my repo folder /atlantis-repo . Instead, I have added the following code in values.yml file which is deployed using helm chart
---
repos:
- id: <http://bitbucket.org/******/atlantis-repo|bitbucket.org/******/atlantis-repo>
  apply_requirements: []
  workflow: default
  allowed_overrides: []
  allow_custom_workflows: false
workflows:
  default:
    plan:
      steps:
       - run: "terraform init"
       - run: "terraform plan"
    apply:
      steps:
       - run: "terraform apply"
3. On the pod where atlantis is running, this is the folder path /atlantis-data/repos/*****/atlantis-repo where the code from bitbucket is pulled 4. This is what is shown on the initial auto plan
Ran Plan for dir: . workspace: default
j

Jason Reslock

04/11/2023, 5:35 PM
I’m not sure what else to look at. I am not using helm/k8s so my configuration is very different. My repos all have an
atlantis.yaml
at the repo root with configs that look like this:
version: 3
parallel_plan: true
parallel_apply: true
projects:
  - dir: terraform/tenants/dev/demo
    autoplan:
      when_modified: ["../../../modules/**/*.tf", "*.tf*"]
And my
repos.yaml
on the atlantis server-side looks like this:
repos:
  - id: /.*/
    # allowed_overrides specifies which keys can be overridden by this repo in
    # its atlantis.yaml file.
    allowed_overrides: [apply_requirements, workflow]
    apply_requirements: [approved,mergeable]
    # allow_custom_workflows defines whether this repo can define its own
    # workflows. If false (default), the repo can only use server-side defined
    # workflows.
    allow_custom_workflows: true
    # This hook is to work around <https://github.com/runatlantis/atlantis/issues/2221>
    pre_workflow_hooks:
      - run: git config --global --add safe.directory '*'


# Defining default and release workflows here to centralize simplify for self-service repos
workflows:
  default:
    plan:
      steps:
        #- run: terraform fmt -check=true -write=false -diff=true -recursive=true
        - init
        - plan
    apply:
      steps:
        - apply
p

Priyashree Shetty

04/11/2023, 5:44 PM
Okay. Thank you