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

EC2 tags #555

Open
ckajrolkar opened this issue Sep 20, 2021 · 3 comments
Open

EC2 tags #555

ckajrolkar opened this issue Sep 20, 2021 · 3 comments

Comments

@ckajrolkar
Copy link

Hello, We have observed that due when perform kitchen create using ec2 its not taking tags that we define in yml file .
what should be formate set addtiona tags as we have setting up tag policy in aws

@deric4
Copy link

deric4 commented Sep 29, 2021

@ckajrolkar can you share an example kitchen.yml file? without it, kinda impossible to help trouble shoot.

for example the following example launches an instance with both the created-by tag and the Name tag

driver:
  name: ec2
  instance_type: t3.medium
  region: us-east-2
  interface: id
  user_data: |
    #!/bin/bash
    echo "hello userdata"
  image_search:
    owner-id: "099720109477" #canonical account id
    name: "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"
  tags:
     created-by: test-kitchen

transport:
  username: ubuntu

platforms:
  - name: platform-1

provisioner:
  name: shell

verifier:
  name: shell
  command: |
    echo 'hello verifier'
    exit 0

suites:
  - name: default
    provisioner:
      name: shell
      command: echo "hello default  suite provisioner"
    driver:
      name: ec2
      tags:
        Name: test-kitchen-example-instance

Steps

create the instance

# create the instance
$ kitchen create

verify tags are created using the aws-cli

$ aws ec2 describe-instances --instance-id <instance id show in logs from previous step> --query 'Reservations[*].Instances[].Tags[]'
[
    {
        "Key": "Name",
        "Value": "test-kitchen-example-instance"
    },
    {
        "Key": "created-by",
        "Value": "test-kitchen"
    }
]

@jakauppila
Copy link
Contributor

To specify multiple tags within the kitchen.yml you can specify the following:

tags:
  created-by: 'test-kitchen'
  reason: 'Only used for testing can be deleted'

image

@tas50
Copy link
Member

tas50 commented Dec 21, 2021

Shipped in 3.12.0

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

4 participants