Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

Errors from basic terraform config #70

Open
danprince opened this issue Dec 14, 2016 · 1 comment
Open

Errors from basic terraform config #70

danprince opened this issue Dec 14, 2016 · 1 comment

Comments

@danprince
Copy link

Having a tough time getting Stack deployed. I'm working with the absolute basic terraform config:

module "stack" {
  source      = "github.com/segmentio/stack"
  environment = "prod"
  key_name    = "id_rsa"
  name        = "my-app"
}

I've downloaded the terraform binary (v0.7.13), added my public key to us-west-2, run terraform get and terraform plan all without problems. My AWS credentials are added as environment variables. Then I tried terraform apply.

image

After 10 minutes of trying to create the autoscaling cluster, it gives up and reports the following errors:

Error applying plan:

2 error(s) occurred:

* aws_s3_bucket.logs: Error creating S3 bucket: BucketAlreadyExists: The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again.
        status code: 409, request id: 4BB52027C19E648C
* aws_autoscaling_group.main: "my-app": Waiting up to 10m0s: Need at least 3 healthy instances in ASG, have 0

This is running on a completely clean new AWS account, so there are no resources kicking around from old projects that could be conflicting.

@danprince
Copy link
Author

I hadn't realised that S3 bucket names need to be completely unique, so I swapped the app name to my-app-testing.

1 error(s) occurred:

* aws_iam_role.default_ecs_role: diffs didn't match during apply. This is a bug with Terraform and should be reported as a GitHub Issue.

Please include the following information in your report:

    Terraform Version: 0.7.13
    Resource ID: aws_iam_role.default_ecs_role
    Mismatch reason: diff: Destroy; old: false, new: true
    Diff One (usually from plan): *terraform.InstanceDiff{mu:sync.Mutex{state:0, sema:0x0}, Attributes:map[string]*terraform.ResourceAttrDiff{"arn":*terraform.ResourceAttrDiff{Old:"arn:aws:iam::657353056284:role/ecs-role-my-app-prod", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "unique_id":*terraform.ResourceAttrDiff{Old:"AROAJQJVJR5J2N6K3MQLU", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "name":*terraform.ResourceAttrDiff{Old:"ecs-role-my-app-prod", New:"ecs-role-my-app-testing-prod", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Sensitive:false, Type:0x0}, "path":*terraform.ResourceAttrDiff{Old:"/", New:"/", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "assume_role_policy":*terraform.ResourceAttrDiff{Old:"{\n  \"Version\": \"2008-10-17\",\n  \"Statement\": [\n    {\n      \"Action\": \"sts:AssumeRole\",\n      \"Principal\": {\n        \"Service\": [\n          \"ecs.amazonaws.com\",\n          \"ec2.amazonaws.com\"\n        ]\n      },\n      \"Effect\": \"Allow\"\n    }\n  ]\n}\n", New:"{\n  \"Version\": \"2008-10-17\",\n  \"Statement\": [\n    {\n      \"Action\": \"sts:AssumeRole\",\n      \"Principal\": {\n        \"Service\": [\n          \"ecs.amazonaws.com\",\n          \"ec2.amazonaws.com\"\n        ]\n      },\n      \"Effect\": \"Allow\"\n    }\n  ]\n}\n", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "create_date":*terraform.ResourceAttrDiff{Old:"2016-12-14T16:16:50Z", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}}, Destroy:false, DestroyTainted:false}
    Diff Two (usually from apply): *terraform.InstanceDiff{mu:sync.Mutex{state:0, sema:0x0}, Attributes:map[string]*terraform.ResourceAttrDiff{"arn":*terraform.ResourceAttrDiff{Old:"arn:aws:iam::657353056284:role/ecs-role-my-app-prod", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "unique_id":*terraform.ResourceAttrDiff{Old:"AROAJQJVJR5J2N6K3MQLU", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "name":*terraform.ResourceAttrDiff{Old:"ecs-role-my-app-prod", New:"ecs-role-my-app-testing-prod", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Sensitive:false, Type:0x0}, "path":*terraform.ResourceAttrDiff{Old:"/", New:"/", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "assume_role_policy":*terraform.ResourceAttrDiff{Old:"{\n  \"Version\": \"2008-10-17\",\n  \"Statement\": [\n    {\n      \"Action\": \"sts:AssumeRole\",\n      \"Principal\": {\n        \"Service\": [\n          \"ecs.amazonaws.com\",\n          \"ec2.amazonaws.com\"\n        ]\n      },\n      \"Effect\": \"Allow\"\n    }\n  ]\n}\n", New:"{\n  \"Version\": \"2008-10-17\",\n  \"Statement\": [\n    {\n      \"Action\": \"sts:AssumeRole\",\n      \"Principal\": {\n        \"Service\": [\n          \"ecs.amazonaws.com\",\n          \"ec2.amazonaws.com\"\n        ]\n      },\n      \"Effect\": \"Allow\"\n    }\n  ]\n}\n", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "create_date":*terraform.ResourceAttrDiff{Old:"2016-12-14T16:16:50Z", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}}, Destroy:true, DestroyTainted:false}

Also include as much context as you can about your config, state, and the steps you performed to trigger this error.


Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

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

No branches or pull requests

1 participant