Code Monkey home page Code Monkey logo

aws-mixin's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

aws-mixin's Issues

Repeated flags working as intended?

Describe the bug

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 ?

To Reproduce

Steps to reproduce the behavior:

There are several scenarios here:

1. Multiple items added as a YAML sequence

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

2. Multiple items added as a formatted string

Replace the SG sequence with:

security-group-ids: "\"sg-xxxxxxxx\" \"sg-xxxxxxxx\""

3. Multiple items added as a 'simple' string

Replace the SG sequence with:

security-group-ids: "sg-xxxxxxxx sg-xxxxxxxx"

Expected behavior

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 Command and Output

porter install --cred aws_nonprod_creds --debug

For the different scenarios:

1. Multiple items added as a YAML sequence:

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!)

2. Multiple items added as a formatted string

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.

3. Multiple items added as a 'simple' string

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

Version

porter v0.23.0-beta.1 (9c49056)
aws v0.2.1-beta.1 (can't seem to find version hash)

Issue where multiple --parameter-overrides are not received by AWS CLI when called from porter

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>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.