getporter / aws-mixin Goto Github PK
View Code? Open in Web Editor NEWPorter mixin for the AWS CLI
Home Page: https://getporter.org/mixins/aws
License: Apache License 2.0
Porter mixin for the AWS CLI
Home Page: https://getporter.org/mixins/aws
License: Apache License 2.0
Ref #16 for functionality and getporter/porter#963 for docs
When using the aws mixin multiple flags don't seem to work correctly. The action I am trying to perform is create an ec2 instance with multiple security groups. This could be related to #11 ?
Steps to reproduce the behavior:
There are several scenarios here:
install:
- aws:
description: "Provision VM"
service: ec2
operation: run-instances
flags:
image-id: ami-xxxxxxxxxxxxxxxxx
instance-type: t2.micro
region: eu-west-1
subnet-id: subnet-xxxxxx
security-group-ids:
- sg-xxxxxxxx
- sg-xxxxxxxx
Replace the SG sequence with:
security-group-ids: "\"sg-xxxxxxxx\" \"sg-xxxxxxxx\""
Replace the SG sequence with:
security-group-ids: "sg-xxxxxxxx sg-xxxxxxxx"
That you can add multiple items, for instance multiple SGs to a yaml config and have them all attach. Some of the above options produce the correct output in the debug console (running install with the --debug
flag) but the commands don't seem to work.
porter install --cred aws_nonprod_creds --debug
For the different scenarios:
This adds multiple --security-group-ids
to the aws ec2
command:
aws ec2 run-instances --image-id ami-xxxxxxxxxxxxxxxxx --instance-type t2.micro --output json --region eu-west-1 --security-group-ids sg-xxxxxxxx --security-group-ids sg-xxxxxxxx --subnet-id subnet-xxxxxxxx
Only the last is chosen and applied - I think this is in the AWS docs somewhere, but can't remember where (sorry!)
This would seem to produce a correctly formatted output (i.e. if you run something like this outside of porter then it will run and create you an instance as intended)
aws ec2 run-instances --image-id ami-xxxxxxxxxxxxxxxxx --instance-type t2.micro --output json --region eu-west-1 --security-group-ids "sg-xxxxxxxx" "sg-xxxxxxxx" --subnet-id subnet-xxxxxxxx
But the error that you get is: The parameter groupName cannot be used with the parameter subnet
. To me this implies it is trying to do something with the default subnet or an SG that is not in the same subnet - however, I have checked on my example and it works outside of the bundle so this is not the case.
This would also seem to produce a correctly formatted output - same as no.2 just without quotes around the SGs:
aws ec2 run-instances --image-id ami-xxxxxxxxxxxxxxxxx --instance-type t2.micro --output json --region eu-west-1 --security-group-ids sg-xxxxxxxx sg-xxxxxxxx --subnet-id subnet-xxxxxxxx
The error is the same as for no.2: The parameter groupName cannot be used with the parameter subnet
porter v0.23.0-beta.1 (9c49056)
aws v0.2.1-beta.1 (can't seem to find version hash)
Add build badge to top of README.
Pipeline is: https://dev.azure.com/getporter/porter/_build?definitionId=5
Hi, I believe this to be some interaction between porter and the porter-aws mixin.
Problem:
Porter calling the "aws cloudformation deploy" command with the flag --parameter-overrides Key1=Value1 Key2=Value2 --someOtherFlag, appears to only pass in the first Key1=Value1 .
However, if I launch a container of the porter image, I can manually run the cloudformation command copied and pasted and it will run fine.
Here is the output of the error from Porter's debug output of the step. If I swap the 2 parameters around, it will toggle the error of which key is missing and only take the first.
Upsert stack
DEBUG mixin: aws
DEBUG mixinDir: /cnab/app/mixins/aws
DEBUG file:
DEBUG stdin:
install:
- aws:
description: Upsert stack
flags:
no-fail-on-empty-changeset: null
parameter-overrides: Key1=Value1 Key2=Value2
region: eu-west-1
stack-name: stack-x
template-file: CFtemplates/Template.template
operation: deploy
service: cloudformation
/cnab/app/mixins/aws/aws-runtime install --debug
/usr/local/bin/aws aws cloudformation deploy --no-fail-on-empty-changeset --output json --parameter-overrides Key1=Value1 Key2=Value2 --region eu-west-1 --stack-x --template-file CFtemplates/Template.template
DEBUG Parsed Input:
&aws.Action{Steps:[]aws.Steps{aws.Steps{Step:aws.Step{Description:"Upsert stack", Service:"cloudformation", Operation:"deploy", Arguments:[]string(nil), Flags:builder.Flags{builder.Flag{Name:"no-fail-on-empty-changeset", Values:[]string(nil)}, builder.Flag{Name:"parameter-overrides", Values:[]string{"Key1=Value1 Key2=Value2"}}, builder.Flag{Name:"region", Values:[]string{"eu-west-1"}}, builder.Flag{Name:"stack-name", Values:[]string{"stack-x"}}, builder.Flag{Name:"template-file", Values:[]string{"CFtemplates/Template.template"}}}, Outputs:[]aws.Output(nil)}}}}
An error occurred (ValidationError) when calling the CreateChangeSet operation: Parameters: [Key2] must have values
err: error running command /usr/local/bin/aws aws cloudformation deploy --no-fail-on-empty-changeset --output json --parameter-overrides Key1=Value1 Key2=Value2 --region eu-west-1 --stack-name stack-x --template-file CFtemplates/Template.template: exit status 255
Error: error running command /usr/local/bin/aws aws cloudformation deploy --no-fail-on-empty-changeset --output json --parameter-overrides Key1=Value1 Key2=Value2 --region eu-west-1 --stack-name stack-x --template-file CFtemplates/Template.template: exit status 255
Error: mixin execution failed: exit status 1
Resolved instance-store plugin to instance-store.porter.filesystem
C:\Users\x\.porter\porter plugin run instance-store.porter.filesystem
Error: 1 error occurred:
* failed to install the bundle: container exit code: 1, message: <nil>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.