Skip to content
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

Relax atlantis.yaml validation #1553

Closed
liaden opened this issue May 4, 2021 · 2 comments
Closed

Relax atlantis.yaml validation #1553

liaden opened this issue May 4, 2021 · 2 comments
Labels
go Pull requests that update Go code quick-win Is obviously something Atlantis should do and will take <4 hrs work

Comments

@liaden
Copy link

liaden commented May 4, 2021

I want to use the gitlab style approach of defining some common configuration to DRY my atlantis.yaml, but atlantis isn't too happy.

Given a config with:

.default-autoplan: &default-autoplan
    autoplan:
      when_modified:
        - "../modules/**/*.tf"
        - "**/*.tf*"
        
projects:
  - <<: *default-autoplan
    dir: infra
  - <<: *default-autoplan
    dir: production
  - <<: *default-autoplan
    dir: staging

I get the following error:

  line 5: field .default-autoplan not found in type raw.RepoCfg
@clatour
Copy link

clatour commented May 4, 2021

It seems like atlantis doesn't like the top-level key you've referenced here, but something like this works:

version: 3
automerge: true
parallel_apply: true
parallel_plan: false
projects:
  - &default-project
    dir: infra
    terraform_version: v0.15.1
    autoplan: &default-autoplan
      enabled: false
      when_modified:
        - "../modules/**/*.tf"
        - "**/*.tf*"
    apply_requirements: [mergeable]
  - <<: *default-project
    dir: production
  - <<: *default-project
    dir: staging
    autoplan: *default-autoplan

@acastle acastle added go Pull requests that update Go code quick-win Is obviously something Atlantis should do and will take <4 hrs work labels May 5, 2021
@acastle
Copy link
Contributor

acastle commented May 5, 2021

This looks like a one liner change if we wanted to proceed down this path

if err := yaml.UnmarshalStrict(configData, &rawCfg); err != nil {

I'm curious if @lkysow has any background knowledge here since it looks like there was a deliberate choice made to strictly validate all of the fields in the config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code quick-win Is obviously something Atlantis should do and will take <4 hrs work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants