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

Export Global Variables for TerraformValidateStage #416

Open
vincentclee opened this issue Jan 31, 2022 · 1 comment
Open

Export Global Variables for TerraformValidateStage #416

vincentclee opened this issue Jan 31, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@vincentclee
Copy link
Contributor

Global Variables are not available at the TerraformValidateStage. Please add them. Thank You.

main.tf

provider "aws" {
  default_tags {
    tags = {
      Environment = "Test"
      Owner       = "TFProviders"
      Project     = "Test"
    }
  }
}

Customizations.groovy

TerraformEnvironmentStage
  .withGlobalEnv("AWS_DEFAULT_REGION", "us-east-1")

Pipeline

Jenkinsfile.init(this, Customizations)

def validate = new TerraformValidateStage()

validate.build()

Error Message

 + terraform validate
 ╷
 │ Error: Missing required argument
 │ 
 │   on main.tf line 2, in provider "aws":
 │    2: provider "aws" {
 │ 
 │ The argument "region" is required, but no definition was found.
 ╵
@kmanning
Copy link
Collaborator

kmanning commented Feb 3, 2022

Hrm, withGlobalEnv seems like a poor choice of name. But I would not have expected a method on one Stage (TerraformEnvironmentStage), to affect a completely different Stage (TerraformValidateStage)?

This is a good UseCase though, and feels like it should be extended beyond just TerraformValidateStage.

@kmanning kmanning added the enhancement New feature or request label Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants