Get variables from AWS via awscli

Hi there, what we are trying to achieve is a bit tricky, I’ll try to explain as much clarity as possible.
We have a process that invokes an AWS CloudFormation template (JSON), unfortunately, we can only configure the Parameters as static, so it means that the end-user should be aware of the AWS resources available that he can or cannot use.
Example: If a team needs to deploy a new Subnet, they need to know the range/subnets available right?
so here my question, Can I create a variable that invokes a command like aws ec2 describe-vpcs, and it fills automatically a drop-down menu?
with Jenkins, I was able to do it with a groovy script, but honestly, on Octopus I have no idea, any help will be appreciated.

Hi Carmine,

The short answer is this is not possible.

Were you looking to set these up as prompted variables in Octopus?
If so, the best I can suggest is to use to the Description field on the prompted variable to explain to users how to obtain the valid values, possibly even supplying a URL. And you could then validate the value supplied as part of your deployment process.

I realize this isn’t the answer you were hoping for.

Regards,
Michael

Morning Michael,
Thanks for the prompt reply, I got your idea, but unfortunately it goes a bit far on what we were planning to do.

Do you know if the octopus team will release a feature about it ?

Thanks

Hi again, I’m trying to pass some variables via JSON but I’m having a problem, I’ve created Project Variables

and I’m trying to invoke a deploy via API, and trying to pass all the variables that I need, this is the JSON

https://octopus/api/deployments

 {
  "ProjectId":"Projects-327",
  "EnvironmentID":"Environments-1",
  "ReleaseID": "Releases-52420", 
  "Variables": [
        {
            "Name": "AWS-STACK-NAME",
            "Value": "TEST-DEPLOY",
            "Description": null,
            "Scope": {},
            "IsEditable": true,
            "Prompt": {
                "Label": "AWS-STACK-NAME",
                "Description": "",
                "Required": false,
                "DisplaySettings": {
                    "Octopus.ControlType": "SingleLineText"
                }
            },
            "Type": "String",
            "IsSensitive": false
        },

but octopus returns this error

Running the step as the AWS user cf_user_test

July 17th 2019 16:30:33

Error

Amazon.CloudFormation.AmazonCloudFormationException: 1 validation error detected: Value ‘Specify the Stack Name’ at ‘stackName’ failed to satisfy constraint: Member must satisfy regular expression pattern: [a-zA-Z][-a-zA-Z0-9]* —> Amazon.Runtime.Internal.HttpErrorResponseException: The remote server returned an error: (400) Bad Request. —>

So it looks like I’m not passing the correct parameter, any idea?

thanks for the help

Hey Carmine,

That’s not quite the right way to pass prompted variables when creating a deployment. They actually get supplied in the FormValues property of the deployment, which holds name-value pairs. This gist should provide an example.

Regarding your earlier question, to be honest this isn’t on our current roadmap. I will raise your suggestion with the team though.

I hope that helps! Let me know if that doesn’t get you there.

Thanks for the help!