Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kitchen-ec2 - iam_profile_name fog not passing through #94

Closed
balldarrens opened this issue Feb 11, 2015 · 6 comments
Closed

kitchen-ec2 - iam_profile_name fog not passing through #94

balldarrens opened this issue Feb 11, 2015 · 6 comments

Comments

@balldarrens
Copy link

Attempting to generate an EC2 instance with a IAM role attached to it is not working. I am expected the ec2 instance to come up and have a IAM role attached to it (for auth and cli usage to happen without credentials).
Using the following versions of gems:
test-kitchen-1.3.1
fog-1.27.0
kitchen-ec2-0.8.0

I am setting the iam_profile_name (as well as trying iam_instance_profile_arn) and this is not passed to the server create.

kitchen file (redacted):

driver:
name: ec2
aws_access_key_id: <%= ENV['AWS_ACCESS_KEY'] %>
aws_secret_access_key: <%= ENV['AWS_SECRET_KEY'] %>
aws_ssh_key_id: <%= ENV['AWS_SSH_KEY_ID'] %>
ssh_key: <%= File.expand_path('~/.ssh/id_rsa') %>
username: ec2-user
iam_profile_name: ec2-role
iam_instance_profile_arn: <%= ENV['AWS_INTANCE_PROFILE_ARN'] %>
http_proxy: <%= ENV['AWS_HTTP_PROXY'] %>
https_proxy: <%= ENV['AWS_HTTPS_PROXY'] %>

provisioner:
name: chef_solo
chef_omnibus_url: http://www.getchef.com/chef/install.sh
require_chef_omnibus: true

platforms:

  • name: amazon
    driver_pluing: ec2
    driver_config:
    image_id: <%= ENV['AWS_AMI_IMAGE'] %>
    region: us-west-2
    availability_zone: us-west-2a
    security_group_ids: "[<%= ENV['AWS_SG_ID'] %>]"
    vpc_mode: true
    subnet_id: "<%= ENV['AWS_SUBNET_ID] %>"
    vpc: "<%= ENV['AWS_SUBNET_ID] %>"
    flavor_id: "m1.small"
    tags:
    Name: testing
    created-by: test-kitchen

Debug output, for section as instance is create, no IAM information display in the output, as expected and the excon.request contains no iam information at all:

-----> Starting Kitchen (v1.3.1)
D Berksfile found at ./Berksfile, loading Berkshelf
D Berkshelf 3.2.3 library loaded
D Berksfile found at ./Berksfile, loading Berkshelf
D Berkshelf 3.2.3 previously loaded
-----> Cleaning up any prior instances of
-----> Destroying ...
Finished destroying (0m0.00s).
-----> Testing
-----> Creating ...
D ec2:region 'us-west-2'
D ec2:availability_zone 'us-west-2a'
D ec2:flavor_id 'm1.small'
D ec2:ebs_optimized 'false'
D ec2:image_id 'ami-XXXXXXXX'
D ec2:security_group_ids '["sg-XXXXXXXX"]'
D ec2:tags '{:Name=>"testing", :"created-by"=>"test-kitchen"}'
D ec2:key_name 'development-preprod'
D ec2:subnet_id 'subnet-XXXXXXXX'
excon.request
:body => "Action=RunInstances&EbsOptimized=false&ImageId=ami-XXXXXXXX&InstanceType=m1.small&KeyName=development-preprod&MaxCount=1&MinCount=1&Placement.AvailabilityZone=us-west-2a&SecurityGroupId.1=sg-XXXXXXXX&SubnetId=subnet-XXXXXXX&Version=2014-10-01"
:chunk_size => 1048576
:ciphers => "HIGH:!SSLv2:!aNULL:!eNULL:!3DES"
:connect_timeout => 60
:debug_request => true
:debug_response => true
:expects => 200
:headers => {
"Authorization" => "REDACTED"
"Content-Type" => "application/x-www-form-urlencoded"
"Host" => "ec2.us-west-2.amazonaws.com"
"User-Agent" => "fog/1.27.0 fog-core/1.28.0"
"x-amz-date" => "20150211T165725Z"
}
:host => "ec2.us-west-2.amazonaws.com"
:hostname => "ec2.us-west-2.amazonaws.com"
:idempotent => false
:instrumentor => Excon::StandardInstrumentor
:instrumentor_name => "excon"
:method => "POST"
:middlewares => [
Excon::Middleware::ResponseParser
Excon::Middleware::Expects
Excon::Middleware::Idempotent
Excon::Middleware::Instrumentor
Excon::Middleware::Mock
]
:mock => false
:nonblock => true
:omit_default_port => false
:path => "/"
:persistent => nil
:port => 443
:query => nil
:read_timeout => 60
:response_block => #<Proc:0x007fa9e9452be0@/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/fog-xml-0.1.1/lib/fog/xml/sax_parser_connection.rb:31 (lambda)>
:retries_remaining => 4
:retry_limit => 4
:scheme => "https"
:ssl_verify_peer => true
:tcp_nodelay => false
:thread_safe_sockets => true
:uri_parser => URI
:versions => "excon/0.44.1 (x86_64-darwin12.0) ruby/2.1.4"
:write_timeout => 60

@balldarrens
Copy link
Author

This seems to be a PEBKAC issue. Having pointed to github for my gem (kitchen-ec2), I have pulled kitchen-ec2-9b9aa1a6b1ef or the dev version of this. This has solved my problem. :)

@volker-fr
Copy link

I wouldn't call this PEBKAC. The latest gem is over one year old. And if you install it via chef gem install kitchen-ec2 you miss a lot of bug fixes.

@balldarrens
Copy link
Author

Ok. How is responsible for getting the latest to rubygems? It would make the task at hand easier.

@balldarrens balldarrens reopened this Feb 19, 2015
@sharpyy
Copy link

sharpyy commented Feb 20, 2015

+1

@jeffbyrnes
Copy link

See #65 for ongoing conversation regarding a new version of this gem being released to RubyGems.

@tyler-ball
Copy link
Contributor

Hey! This should be fixed in the latest version of kitchen-ec2 (0.9.0). Can you try that and re-open this if it is not fixed? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants