I have a Jenkinsfile in which I am fetching a value from AWS console ; and storing in a variable my_es_host , and there is a parameter in my terraform.tfvars file i.e. es_host="". I am trying to insert the value of variable my_es_host in the terraform file. Below is the sed command I am using in the Jenkinsfile:
sh 'sed -i "s/es_host=\"\"/es_host=\"$my_es_host\"/g" terraform.tfvars
This is working as expected in Linux terminal. However, this sed command does not work in a Jenkinsfile. Can someone help me on this please ?