test-kitchen/kitchen-ec2

kitchen-ec2 not picking the image-id provided to while spinning the instance its taking some default image

Vasu1105 opened this issue · 4 comments

🗣️ Foreword

Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.

👻 Brief Description

kitchen ec2 not picking the image-id that has been provided in the kitchen.yml. It is picking some default image to spin the instance.
On further debugging I found that config[:image_id] is coming nil here

Version

v3.6.0
[Version of the project installed]

Environment

[Details about the environment such as the Operating System, cookbook details, etc...]

Scenario

[What you are trying to achieve and you can't?]

Steps to Reproduce

[If you are filing an issue what are the things we need to do in order to repro your problem?]

example:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected Result

[What are you expecting to happen as the consequence of above reproduction steps?]

Actual Result

[What actually happens after the reproduction steps?]

➕ Additional context

Add any other context about the problem here. e.g. related issues or existing pull requests.

@Vasu1105 can you provide an example kitchen.yml ?

@deric4 here is the one.

driver:
  name: ec2
  shared_credentials_profile: xxxxx
  region: us-west-2
  # This security group is in the Chef Partner account
  # TODO: Make the account used for testing configurable
  security_group_ids: ['sg-xxxxxf']
  interface: dns
  associate_public_ip: true
  aws_ssh_key_id: xxxxxx
  block_device_mappings:
  - device_name: /dev/sda1
    ebs:
      volume_size: 30
      delete_on_termination: false

transport:
  ssh_key: ~/.ssh/xxxxx.pem

provisioner:
  name: chef_zero
  deprecations_as_errors: false
  chef_license: accept

verifier:
  name: inspec
  sudo: true
  reporter:
    - cli
    - json:.kitchen/logs/%{platform}_%{suite}_inspec.json

platforms:
  - name: windows-2019
    transport:
      name: winrm
      elevated: true
    driver:
      retryable_tries: 240
      image-id: ami-0300fe0852e0add56
      instance_type: t3.large
      tags:
        Name: compliance_profiles_windows_2019
        created-by: test-kitchen

suites:
  - name: windows2019_memberserver_v1.1.0
    named_run_list: kitchen_remediation_windows_2019
    includes:
      - windows-2019
    verifier:
      inspec_tests:
        - path: test/integration/default/inspec/cis-windows2019-level2-memberserver-v1.1.0

I think you just need to change the - to _ like so:

  image_id: ami-0300fe0852e0add56

Thanks. @deric4 closing this.