That is a great question which will have multiple answers!
I’ve reached out to our Solutions team for some advice about the best approach to this and we’ll keep you updated!
I believe the difficulty is targeting a file on the local system, if the JSON file was in a package uploaded to the Octopus Built-in Feed, then you could leverage ‘Structured configuration variables’ or ‘Substitute variables in templates’ to achieve the variable substitution. Both of these are configurable features for the deployment process found at the bottom of the page.
Feel free to let me know if you have any questions!
Thanks @finnian.dempsey for your reply, can I then add one step before this to dynamically push the json file/object with variable name in it to the octo package? but how would the local variable value be replaced in json? variable would need to populated by reading SSM Parameter store…
Before talking about changing your process, I’d like to start basic to make sure I understand all the pieces of the puzzle. Where does that .json file currently live? How does that file make it to a location for that step to access?
Thanks @Bob_Walker for looking into this. The .json file is currently in the shared folder and I am passing the shared path in the aws cli command like below -
Great, thank you for providing that additional context.
A couple of options for you.
Option 1
Copy that shared file to the local directory (working directory) in a step prior to your script.
Use the structure variable replacement to change the value you wish to change. The path you provide to the target files can be either relative or absolute. The default is relative.
Store the JSON content of that file as an Octopus Variable. Variables can be multi-line values. That variable will have the octostache syntax for the lambda ARN, IE #{YourLambaArnValue}