In our current project the variables are hard coded to library variable set. How ever we are trying to update the variables set declared in project dynamically using without manual intervention. But it does not work. Please suggest how can i update variables in the project via bash using terraform output.
Hey there @ajitesh.baloria! I’d like to make sure I understand what your overall goals are. If I may paraphrase, you’re wanting to use the Octopus Terraform provider to update the variables in your Octopus project?
Yes, At the moment we added variables manually and they are hard coded in octopus deploy. What we are trying is that we have terraform state configuration file in s3 bucket that has passwords which are updated dynamically. Now we want make sure that we can update the variables and password automatically in octopus deploy before running the release. If there is any article related to this do share , that would be great help
Ah! Okay, thank you for the clarification Yes, you can update variables using the Terraform provider, we have an upcoming webinar that talks about this subject, Managing Octopus Deploy with Terraform - Octopus Deploy. You stated that you wanted to update the password before running the release, this will be a different process if the release has already been created. When a release is created, all variables are snapshotted. There is a mechanism to update them for an existing release, however, that is done via an API call. Does that make sense?
Makes sense, so when i do an api call before the release will it update the variables that are hardcoded. And please share document link for api as well. thank you for replying back
Yes, using the API to call the update variables endpoint will update the snapshotted variables within a release. We have an example of how to do this - Update release variable snapshot - Octopus Deploy
Hope all is well. I refereed the api documentation , how ever it is in powershell but i managed to convert it to bash but still i am getting . PFB converted script. Here project.testvar is the variable i am trying to update, so initially the value was hardcoded to say “Password123” now i am trying to change it to say “testrun12345”.
Awesome, thank you for clarifying. Is the code you pasted your whole script? It looks like it might be missing some pieces. If not, can you paste the whole thing (minus the sensitive bits, of course)?