Search code examples
aws-lambdaoctopus-deploy

AWS Create Lambda script parameters output as parameter name, not value


I am running this Octopus community script for creating or updating a lambda function.

When we hard-code values for the parameters, the script works as advertised. However, when we define variables for use in the parameters, it always injects the name of the Octopus variable instead of the value.

Such that a variable named AWS_Dash_OrderOnline_Lambda_Function_Name is read as #{AWS_Dash_OrderOnline_Lambda_Function_Name} for the value instead of the actual variable value.

What's going on and what do I need to change?

Pertinent script code is below:

# Get the parameters.
$functionName = $OctopusParameters['FunctionName']
...
Write-Output $functionName

Output:

#{AWS_Dash_OrderOnline_Lambda_Function_Name} 

Solution

  • You'll get the variable back as the value like this if a value cannot be determined. This could be because of a typo in the name, or it could be that there is no value for the variable that matches the scope of the current deployment.

    For example, you may have a value for a variable called Foo defined for Prod and not for Dev. When you run a deployment into Dev you'll get #{Foo} but in Prod you'd get the actual value.

    A technique I've used is to provide an unscoped value of something like "UnscopedFoo", then if you see that value you know you've got the name entered correctly and it's a scoping issue. If you don't then the name isn't entered correctly.