Regarding how to pass params in jenkinsfile while running the terrafrom plan

14 views
Skip to first unread message

Ashok Reddy

unread,
Apr 25, 2024, 5:32:49 AMApr 25
to jenkins...@googlegroups.com
Hi,

I am trying to pass parameters in jenkinsfile while running the terraform plan.
Can someone please help?

parameters {
        stringParam(envName: 'work', defaultValue: 'gamma', choices:['gamma', 'epsilon', 'referecne'],description: 'Workspace/environment file to use for deployment')
        stringParam(dirName: 'directory', defaultValue: 'workitems', choices:['workitems', 'services', 'ssr', 'user-mgmt'])
        stringParam(branchName: 'branchname', defaultValue:'test_jenkins_microservices', choices:['test_jenkins_microservices', 'master'])
    } docker run -e -c " cd ${WORKSPACE}; ls -l; export TF_LOG=TRACE; chmod +x terraform; terraform plan --var-file 'common.tfvars.json' --var-file='vars/${params.work}.tfvars.json'"
Reply all
Reply to author
Forward
0 new messages