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

terraform ssm association issue #16988

Closed
fdavier opened this issue Dec 26, 2017 · 2 comments
Closed

terraform ssm association issue #16988

fdavier opened this issue Dec 26, 2017 · 2 comments

Comments

@fdavier
Copy link

fdavier commented Dec 26, 2017

Terraform Version

v0.11.1

Terraform Configuration Files

I added "aws_ssm_document" and "aws_ssm_association" after existing instance ressource:
My hope is to be able to launch commands to update/install additional features some linux instances after their creation

resource "aws_instance" "gw0" {
  ami = "ami-d33ecdab"
  key_name = "infav10-devHub"
  instance_type = "m4.large"
  subnet_id = "${aws_subnet.public0.id}"
  associate_public_ip_address = true
  vpc_security_group_ids = ["${aws_security_group.gtw_security_group.id}"]
  private_ip = "10.0.2.11"

  root_block_device {
   volume_type = "gp2"
  }
  
  tags {
    Name = "${var.prefix_tag}-Gateway-0"
  }
      iam_instance_profile = "${aws_iam_instance_profile.gw-instance-profile.name}"
}
resource "aws_eip" "gw0" {
  vpc = true
  instance = "${aws_instance.gw0.id}"
  associate_with_private_ip = "10.0.2.11"
}

resource "aws_ssm_document" "gw_document" {
  name          = "gw_document"
  document_type = "Command"

  content = <<DOC
 {
   "schemaVersion":"2.0",
   "description":"Sample document",
   "mainSteps":[
      {
         "action":"aws:runPowerShellScript",
         "name":"runPowerShellScript",
         "inputs":{
            "runCommand":[
               "hostname"
            ]
         }
      }
   ]
}
DOC
}

resource "aws_ssm_association" "gw0" {
  name        = "gw_document"
  instance_id = "${aws_instance.gw0.id}"
}

Debug Output

2017-12-26T09:43:38.674+0100 [DEBUG] plugin.terraform.exe: local-exec-provisione
r (internal) 2017/12/26 09:43:38 [DEBUG] plugin: waiting for all plugin processe
s to complete...
Error: Error applying plan:

1 error(s) occurred:

* aws_ssm_association.gw0: 1 error(s) occurred:

* aws_ssm_associati2017-12-26T09:43:38.701+0100 [DEBUG] plugin: plugin process e
xited: path=C:\tools\terraform\infa-hub\.terraform\plugins\windows_amd64\terrafo
rm-provider-aws_v0.1.4_x4.exe
on.gw0: [ERROR] Error c2017/12/26 09:43:38 [ERR] yamux: Failed to read stream da
ta: read tcp 127.0.0.1:54622->127.0.0.1:10000: wsarecv: Une connexion existante
a dû être fermée par l'hôte distant.
reat2017/12/26 09:43:38 [ERR] yamux: Failed to write header: write tcp 127.0.0.1
:54622->127.0.0.1:10000: use of closed network connection
2017-12-26T09:43:38.704+0100 [WARN ] plugin: error closing client during Kill: e
rr="unexpected EOF"
ing2017-12-26T09:43:38.705+0100 [DEBUG] plugin: plugin process exited: path=C:\t
ools\terraform\terraform.exe
 SSM association: InvalidDocument: Document schema version, 2.0, is not supporte
d by association that is created with instance id
        status code: 400, request id: ddef467a-ea18-11e7-988e-75f688c18213

Expected Behavior

expect that Association is done and 'hostname' command executed on existing ec2 linux instance

Actual Behavior

Don't execute, see crash output, ssm association don't work

Steps to Reproduce

Please list the full steps required to reproduce the issue, for example:

  1. terraform init
  2. terraform plan
  3. terraform apply

Important Factoids

References

@hashibot
Copy link
Contributor

hashibot commented Jan 3, 2018

This issue has been automatically migrated to hashicorp/terraform-provider-aws#2840 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to this issue and let us know.

@hashibot hashibot closed this as completed Jan 3, 2018
@ghost
Copy link

ghost commented Apr 5, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants