You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I a moved a small project in our tf repo to the new 0.14.0 which has not quite had a stable release, yet. As of today (2020-11-30) the latest release is rc1.
To use this new TF version, I created a new entry in the atlantis.yaml file for the repo:
Note: I also tried a version of the atlantis.yaml file that didn't have the v prefix:terraform_version: 0.14.0-rc1, but this, too, resulted in the same issue. As soon as I tried 0.13.5 the 5 variables were no longer injected, but, of course, i get the warning:
Error refreshing state: state snapshot was created by Terraform v0.14.0, which is newer than current v0.13.5...
I manually ran plan on the collection of TF files in the someCategory/someEntity path and I got this back:
Error: Value for undeclared variable
A variable named "atlantis_repo_name" was assigned on the command line, but
the root module does not declare a variable of that name. To use this value,
add a "variable" block to the configuration.
The same error for a other variables:
atlantis_user
atlantis_repo
atlantis_repo_name
atlantis_repo_owner
atlantis_pull_num
After a bit of digging, i see that those variables are set / fed in to the TF execution for versions of TF less than 12
// If using Terraform >= 0.12 we don't set any of these variables because
// those versions don't allow setting -var flags for any variables that aren't
// actually used in the configuration. Since there's no way for us to detect
// if the configuration is using those variables, we don't set them.
func (p *PlanStepRunner) tfVars(ctx models.ProjectCommandContext, tfVersion *version.Version) []string {
if vTwelveAndUp.Check(tfVersion) {
return nil
}
// NOTE: not using maps and looping here because we need to keep the
// ordering for testing purposes.
// NOTE: quoting the values because in Bitbucket the owner can have
// spaces, ex -var atlantis_repo_owner="bitbucket owner".
return []string{
"-var",
fmt.Sprintf("%s=%q", "atlantis_user", ctx.User.Username),
"-var",
fmt.Sprintf("%s=%q", "atlantis_repo", ctx.BaseRepo.FullName),
"-var",
fmt.Sprintf("%s=%q", "atlantis_repo_name", ctx.BaseRepo.Name),
"-var",
fmt.Sprintf("%s=%q", "atlantis_repo_owner", ctx.BaseRepo.Owner),
"-var",
fmt.Sprintf("%s=%d", "atlantis_pull_num", ctx.Pull.Num),
// MustConstraint will parse one or more constraints from the given
// constraint string. The string must be a comma-separated list of
// constraints. It panics if there is an error.
func MustConstraint(v string) version.Constraints {
c, err := version.NewConstraint(v)
if err != nil {
panic(err)
}
return c
}
My GoLang is pretty weak, so I got lost trying to understand how the -a token is parsed by hashi's lib. I'm not sure if the ">=0.12-a" string needs to be updated or if there's an error in how Hashi's lib is parsing the -rc1 suffix on the version number.
The text was updated successfully, but these errors were encountered:
I a moved a small project in our tf repo to the new
0.14.0
which has not quite had a stable release, yet. As of today (2020-11-30) the latest release isrc1
.To use this new TF version, I created a new entry in the
atlantis.yaml
file for the repo:Note: I also tried a version of the
atlantis.yaml
file that didn't have thev
prefix:terraform_version: 0.14.0-rc1
, but this, too, resulted in the same issue. As soon as I tried0.13.5
the 5 variables were no longer injected, but, of course, i get the warning:I manually ran
plan
on the collection of TF files in thesomeCategory/someEntity
path and I got this back:The same error for a other variables:
atlantis_user
atlantis_repo
atlantis_repo_name
atlantis_repo_owner
atlantis_pull_num
After a bit of digging, i see that those variables are set / fed in to the TF execution for versions of TF less than 12
From here:
atlantis/server/events/runtime/plan_step_runner.go
Line 194 in 6ade4ba
Except, i'm using version 14 of terraform, and 14 > 12. So how is
vTwelveAndUp.Check(tfVersion)
implemented?And what about
MustConstraint
? How does it work?which is a wrapper around this hashi lib: https://github.com/hashicorp/go-version
My GoLang is pretty weak, so I got lost trying to understand how the
-a
token is parsed by hashi's lib. I'm not sure if the">=0.12-a"
string needs to be updated or if there's an error in how Hashi's lib is parsing the-rc1
suffix on the version number.The text was updated successfully, but these errors were encountered: