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

Atlantis init upgrades plugins #1381

Closed
magne opened this issue Feb 1, 2021 · 5 comments
Closed

Atlantis init upgrades plugins #1381

magne opened this issue Feb 1, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@magne
Copy link

magne commented Feb 1, 2021

Atlantis runs terraform init with the -upgrade option. This upgrades plugins even if I've checked in the .terraform.lock.hcl file.

The workaround is to lock the plugins in terraform required_providers , but this should not be necessary. Even if I've requested a range of versions of a plugin, Atlantis should respect the .terraform.lock.hcl file.

The current Atlantis behavior causes non-repeatable builds when using version ranges for providers, which is exactly what the lock file was supposed to prevent.

Terraform version 0.14.4
Atlantis version 0.16

@mathcantin
Copy link
Contributor

I openned this PR for that #1353.

@grimm26
Copy link
Contributor

grimm26 commented Feb 6, 2021

you could write a custom workflow to not run init with -upgrade

@magne
Copy link
Author

magne commented Feb 9, 2021

I know I can use a custom workflow to accomplish this, but I feel that predictable and reproducible builds is a very important feature for a CI (/CD) tool like Atlantis. And disregarding the .terraform.lock.hcl file is definitely not predictable.

As a reference, you can include the following default workflow in your server-side repo config to stop atlantis from upgrading your plugins:

workflows:
  default:
    plan:
      steps:
        - init:
            extra_args:
              - '-upgrade:false'
        - plan:

or if you use the --repo-config-json flag:

{
  ...
  "workflows": {
    "default": {
      "plan": {
        "steps": [
          {
            "init": {
              "extra_args": ["-upgrade:false"]
            }
          },
          {
            "plan": {}
          }
        ]
      }
    }
  }
}

@JeffreyVdb
Copy link

@magne

I think it should be upgrade=false
So that it becomes:

workflows:
  default:
    plan:
      steps:
        - init:
            extra_args:
              - '-upgrade=false'
        - plan:

And for --repo-config-json

{
  "workflows": {
    "default": {
      "plan": {
        "steps": [
          {
            "init": {
              "extra_args": ["-upgrade=false"]
            }
          },
          {
            "plan": {}
          }
        ]
      }
    }
  }
}

The above does work for us

@jamengual
Copy link
Contributor

closed by #1651

@jamengual jamengual added the bug Something isn't working label Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants