Skip to content

Instantly share code, notes, and snippets.

@jonatanblue
Created July 24, 2016 10:30
Show Gist options
  • Save jonatanblue/47bbe65e335effcba3e187063fe4507b to your computer and use it in GitHub Desktop.
Save jonatanblue/47bbe65e335effcba3e187063fe4507b to your computer and use it in GitHub Desktop.
terraform command output
#### Output from `terraform plan`:
$ terraform plan
Refreshing Terraform state prior to plan...
aws_ecs_cluster.example_cluster: Refreshing state... (ID: arn:aws:ecs:us-east-1:123456789012:cluster/example-cluster)
aws_iam_role.ecs_instance: Refreshing state... (ID: ecs-instance)
aws_iam_role.ecs_service_role: Refreshing state... (ID: ecs-service-role)
aws_ecs_task_definition.sinatra_backend: Refreshing state... (ID: sinatra-backend)
aws_security_group.ecs_instance: Refreshing state... (ID: sg-432b2038)
aws_security_group.rails_frontend_elb: Refreshing state... (ID: sg-4c2b2037)
aws_security_group.sinatra_backend_elb: Refreshing state... (ID: sg-422b2039)
aws_iam_instance_profile.ecs_instance: Refreshing state... (ID: ecs-instance)
aws_iam_role_policy.ecs_cluster_permissions: Refreshing state... (ID: ecs-instance:ecs-cluster-permissions)
aws_iam_role_policy.ecs_service_policy: Refreshing state... (ID: ecs-service-role:ecs-service-policy)
aws_elb.rails_frontend: Refreshing state... (ID: rails-frontend)
aws_elb.sinatra_backend: Refreshing state... (ID: sinatra-backend)
aws_launch_configuration.ecs_instance: Refreshing state... (ID: ecs-instance-mzxiahkorne3zd24m7nnflrsd4)
aws_autoscaling_group.ecs_cluster_instances: Refreshing state... (ID: ecs-cluster-instances)
aws_ecs_service.sinatra_backend: Refreshing state... (ID: arn:aws:ecs:us-east-1:123456789012:service/sinatra-backend)
aws_ecs_task_definition.rails_frontend: Refreshing state... (ID: rails-frontend)
aws_ecs_service.rails_frontend: Refreshing state... (ID: arn:aws:ecs:us-east-1:123456789012:service/rails-frontend)
The Terraform execution plan has been generated and is shown below.
Resources are shown in alphabetical order for quick scanning. Green resources
will be created (or destroyed and then created if an existing resource
exists), yellow resources are being changed in-place, and red resources
will be destroyed.
Note: You didn't specify an "-out" parameter to save this plan, so when
"apply" is called, Terraform can't guarantee this is what will execute.
~ aws_ecs_service.rails_frontend
task_definition: "arn:aws:ecs:us-east-1:123456789012:task-definition/rails-frontend:1" => "${aws_ecs_task_definition.rails_frontend.arn}"
-/+ aws_ecs_service.sinatra_backend
cluster: "arn:aws:ecs:us-east-1:123456789012:cluster/example-cluster" => "arn:aws:ecs:us-east-1:123456789012:cluster/example-cluster"
deployment_maximum_percent: "200" => "200"
deployment_minimum_healthy_percent: "50" => "50"
desired_count: "2" => "2"
iam_role: "arn:aws:iam::123456789012:role/ecs-service-role" => "arn:aws:iam::123456789012:role/ecs-service-role"
load_balancer.#: "1" => "1"
load_balancer.502737317.container_name: "sinatra-backend" => ""
load_balancer.502737317.container_port: "4567" => "0"
load_balancer.502737317.elb_name: "sinatra-backend" => ""
load_balancer.~254231428.container_name: "" => "sinatra-backend" (forces new resource)
load_balancer.~254231428.container_port: "" => "4567" (forces new resource)
load_balancer.~254231428.elb_name: "" => "${aws_elb.sinatra_backend.id}" (forces new resource)
name: "sinatra-backend" => "sinatra-backend"
task_definition: "arn:aws:ecs:us-east-1:123456789012:task-definition/sinatra-backend:1" => "arn:aws:ecs:us-east-1:123456789012:task-definition/sinatra-backend:1"
-/+ aws_ecs_task_definition.rails_frontend
arn: "arn:aws:ecs:us-east-1:123456789012:task-definition/rails-frontend:1" => "<computed>"
container_definitions: "0f92fe0a7e925bc391be7e7af214ff6bba503fc7" => "89e5f395e438db5491813a54655fba582e2d7e36" (forces new resource)
family: "rails-frontend" => "rails-frontend"
revision: "1" => "<computed>"
-/+ aws_elb.sinatra_backend
availability_zones.#: "3" => "<computed>"
connection_draining: "false" => "false"
connection_draining_timeout: "300" => "300"
cross_zone_load_balancing: "true" => "true"
dns_name: "sinatra-backend-301981377.us-east-1.elb.amazonaws.com" => "<computed>"
health_check.#: "1" => "1"
health_check.0.healthy_threshold: "2" => "2"
health_check.0.interval: "30" => "30"
health_check.0.target: "HTTP:4567/health" => "HTTP:4567/health"
health_check.0.timeout: "5" => "5"
health_check.0.unhealthy_threshold: "2" => "2"
idle_timeout: "60" => "60"
instances.#: "2" => "<computed>"
internal: "false" => "true" (forces new resource)
listener.#: "1" => "1"
listener.117083116.instance_port: "4567" => "4567"
listener.117083116.instance_protocol: "http" => "http"
listener.117083116.lb_port: "4567" => "4567"
listener.117083116.lb_protocol: "http" => "http"
listener.117083116.ssl_certificate_id: "" => ""
name: "sinatra-backend" => "sinatra-backend"
security_groups.#: "1" => "1"
security_groups.232696854: "sg-422b2039" => "sg-422b2039"
source_security_group: "123456789012/sinatra-backend-elb" => "<computed>"
source_security_group_id: "sg-422b2039" => "<computed>"
subnets.#: "3" => "3"
subnets.2541569726: "subnet-3124460b" => "subnet-3124460b"
subnets.3766871935: "subnet-38929a10" => "subnet-38929a10"
subnets.867788316: "subnet-3e13fb67" => "subnet-3e13fb67"
zone_id: "Z3DZXE0Q79N41H" => "<computed>"
Plan: 3 to add, 1 to change, 3 to destroy.
# Output from first `terraform apply`:
$ terraform apply
aws_iam_role.ecs_instance: Refreshing state... (ID: ecs-instance)
aws_ecs_cluster.example_cluster: Refreshing state... (ID: arn:aws:ecs:us-east-1:123456789012:cluster/example-cluster)
aws_ecs_task_definition.sinatra_backend: Refreshing state... (ID: sinatra-backend)
aws_security_group.ecs_instance: Refreshing state... (ID: sg-432b2038)
aws_iam_role.ecs_service_role: Refreshing state... (ID: ecs-service-role)
aws_security_group.sinatra_backend_elb: Refreshing state... (ID: sg-422b2039)
aws_security_group.rails_frontend_elb: Refreshing state... (ID: sg-4c2b2037)
aws_iam_role_policy.ecs_service_policy: Refreshing state... (ID: ecs-service-role:ecs-service-policy)
aws_iam_role_policy.ecs_cluster_permissions: Refreshing state... (ID: ecs-instance:ecs-cluster-permissions)
aws_iam_instance_profile.ecs_instance: Refreshing state... (ID: ecs-instance)
aws_elb.rails_frontend: Refreshing state... (ID: rails-frontend)
aws_elb.sinatra_backend: Refreshing state... (ID: sinatra-backend)
aws_launch_configuration.ecs_instance: Refreshing state... (ID: ecs-instance-mzxiahkorne3zd24m7nnflrsd4)
aws_autoscaling_group.ecs_cluster_instances: Refreshing state... (ID: ecs-cluster-instances)
aws_ecs_task_definition.rails_frontend: Refreshing state... (ID: rails-frontend)
aws_ecs_service.sinatra_backend: Refreshing state... (ID: arn:aws:ecs:us-east-1:123456789012:service/sinatra-backend)
aws_ecs_service.rails_frontend: Refreshing state... (ID: arn:aws:ecs:us-east-1:123456789012:service/rails-frontend)
aws_ecs_task_definition.rails_frontend: Destroying...
aws_ecs_service.sinatra_backend: Destroying...
aws_ecs_task_definition.rails_frontend: Destruction complete
aws_ecs_service.sinatra_backend: Still destroying... (10s elapsed)
aws_ecs_service.sinatra_backend: Still destroying... (20s elapsed)
aws_ecs_service.sinatra_backend: Still destroying... (30s elapsed)
aws_ecs_service.sinatra_backend: Still destroying... (40s elapsed)
aws_ecs_service.sinatra_backend: Still destroying... (50s elapsed)
aws_ecs_service.sinatra_backend: Still destroying... (1m0s elapsed)
aws_ecs_service.sinatra_backend: Destruction complete
aws_elb.sinatra_backend: Destroying...
aws_elb.sinatra_backend: Destruction complete
aws_elb.sinatra_backend: Creating...
availability_zones.#: "" => "<computed>"
connection_draining: "" => "false"
connection_draining_timeout: "" => "300"
cross_zone_load_balancing: "" => "true"
dns_name: "" => "<computed>"
health_check.#: "" => "1"
health_check.0.healthy_threshold: "" => "2"
health_check.0.interval: "" => "30"
health_check.0.target: "" => "HTTP:4567/health"
health_check.0.timeout: "" => "5"
health_check.0.unhealthy_threshold: "" => "2"
idle_timeout: "" => "60"
instances.#: "" => "<computed>"
internal: "" => "true"
listener.#: "" => "1"
listener.117083116.instance_port: "" => "4567"
listener.117083116.instance_protocol: "" => "http"
listener.117083116.lb_port: "" => "4567"
listener.117083116.lb_protocol: "" => "http"
listener.117083116.ssl_certificate_id: "" => ""
name: "" => "sinatra-backend"
security_groups.#: "" => "1"
security_groups.232696854: "" => "sg-422b2039"
source_security_group: "" => "<computed>"
source_security_group_id: "" => "<computed>"
subnets.#: "" => "3"
subnets.2541569726: "" => "subnet-3124460b"
subnets.3766871935: "" => "subnet-38929a10"
subnets.867788316: "" => "subnet-3e13fb67"
zone_id: "" => "<computed>"
aws_elb.sinatra_backend: Creation complete
aws_ecs_task_definition.rails_frontend: Creating...
arn: "" => "<computed>"
container_definitions: "" => "2c3dc2f98f77f7d2aa532cf68ecd77a4b227759a"
family: "" => "rails-frontend"
revision: "" => "<computed>"
aws_ecs_task_definition.rails_frontend: Creation complete
aws_ecs_service.rails_frontend: Modifying...
task_definition: "arn:aws:ecs:us-east-1:123456789012:task-definition/rails-frontend:1" => "arn:aws:ecs:us-east-1:123456789012:task-definition/rails-frontend:2"
aws_ecs_service.rails_frontend: Modifications complete
Error applying plan:
1 error(s) occurred:
* aws_ecs_service.sinatra_backend: 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.6.16
Resource ID: aws_ecs_service.sinatra_backend
Mismatch reason: attribute mismatch: load_balancer.~254231428.container_name
Diff One (usually from plan): *terraform.InstanceDiff{Attributes:map[string]*terraform.ResourceAttrDiff{"load_balancer.~254231428.container_port":*terraform.ResourceAttrDiff{Old:"", New:"4567", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Type:0x0}, "load_balancer.~254231428.elb_name":*terraform.ResourceAttrDiff{Old:"", New:"${aws_elb.sinatra_backend.id}", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Type:0x0}, "iam_role":*terraform.ResourceAttrDiff{Old:"arn:aws:iam::123456789012:role/ecs-service-role", New:"arn:aws:iam::123456789012:role/ecs-service-role", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Type:0x0}, "deployment_maximum_percent":*terraform.ResourceAttrDiff{Old:"200", New:"200", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Type:0x0}, "load_balancer.502737317.container_port":*terraform.ResourceAttrDiff{Old:"4567", New:"0", NewComputed:false, NewRemoved:true, NewExtra:interface {}(nil), RequiresNew:false, Type:0x0}, "load_balancer.#":*terraform.ResourceAttrDiff{Old:"1", New:"1", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Type:0x0}, "load_balancer.~254231428.container_name":*terraform.ResourceAttrDiff{Old:"", New:"sinatra-backend", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Type:0x0}, "task_definition":*terraform.ResourceAttrDiff{Old:"arn:aws:ecs:us-east-1:123456789012:task-definition/sinatra-backend:1", New:"arn:aws:ecs:us-east-1:123456789012:task-definition/sinatra-backend:1", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Type:0x0}, "cluster":*terraform.ResourceAttrDiff{Old:"arn:aws:ecs:us-east-1:123456789012:cluster/example-cluster", New:"arn:aws:ecs:us-east-1:123456789012:cluster/example-cluster", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Type:0x0}, "deployment_minimum_healthy_percent":*terraform.ResourceAttrDiff{Old:"50", New:"50", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Type:0x0}, "name":*terraform.ResourceAttrDiff{Old:"sinatra-backend", New:"sinatra-backend", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Type:0x0}, "desired_count":*terraform.ResourceAttrDiff{Old:"2", New:"2", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Type:0x0}, "load_balancer.502737317.elb_name":*terraform.ResourceAttrDiff{Old:"sinatra-backend", New:"", NewComputed:false, NewRemoved:true, NewExtra:interface {}(nil), RequiresNew:false, Type:0x0}, "load_balancer.502737317.container_name":*terraform.ResourceAttrDiff{Old:"sinatra-backend", New:"", NewComputed:false, NewRemoved:true, NewExtra:interface {}(nil), RequiresNew:false, Type:0x0}}, Destroy:false, DestroyTainted:false}
Diff Two (usually from apply): *terraform.InstanceDiff{Attributes:map[string]*terraform.ResourceAttrDiff{"load_balancer.#":*terraform.ResourceAttrDiff{Old:"", New:"1", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Type:0x0}, "cluster":*terraform.ResourceAttrDiff{Old:"", New:"arn:aws:ecs:us-east-1:123456789012:cluster/example-cluster", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Type:0x0}, "deployment_maximum_percent":*terraform.ResourceAttrDiff{Old:"", New:"200", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Type:0x0}, "load_balancer.502737317.elb_name":*terraform.ResourceAttrDiff{Old:"", New:"sinatra-backend", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Type:0x0}, "desired_count":*terraform.ResourceAttrDiff{Old:"", New:"2", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Type:0x0}, "deployment_minimum_healthy_percent":*terraform.ResourceAttrDiff{Old:"", New:"50", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Type:0x0}, "name":*terraform.ResourceAttrDiff{Old:"", New:"sinatra-backend", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Type:0x0}, "iam_role":*terraform.ResourceAttrDiff{Old:"", New:"arn:aws:iam::123456789012:role/ecs-service-role", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Type:0x0}, "load_balancer.502737317.container_port":*terraform.ResourceAttrDiff{Old:"", New:"4567", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Type:0x0}, "task_definition":*terraform.ResourceAttrDiff{Old:"", New:"arn:aws:ecs:us-east-1:123456789012:task-definition/sinatra-backend:1", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Type:0x0}, "load_balancer.502737317.container_name":*terraform.ResourceAttrDiff{Old:"", New:"sinatra-backend", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Type:0x0}}, Destroy:false, 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.
# Output from second `terraform apply`:
$ terraform apply
aws_ecs_task_definition.sinatra_backend: Refreshing state... (ID: sinatra-backend)
aws_ecs_cluster.example_cluster: Refreshing state... (ID: arn:aws:ecs:us-east-1:123456789012:cluster/example-cluster)
aws_security_group.ecs_instance: Refreshing state... (ID: sg-432b2038)
aws_iam_role.ecs_instance: Refreshing state... (ID: ecs-instance)
aws_iam_role.ecs_service_role: Refreshing state... (ID: ecs-service-role)
aws_security_group.sinatra_backend_elb: Refreshing state... (ID: sg-422b2039)
aws_security_group.rails_frontend_elb: Refreshing state... (ID: sg-4c2b2037)
aws_iam_role_policy.ecs_service_policy: Refreshing state... (ID: ecs-service-role:ecs-service-policy)
aws_iam_instance_profile.ecs_instance: Refreshing state... (ID: ecs-instance)
aws_iam_role_policy.ecs_cluster_permissions: Refreshing state... (ID: ecs-instance:ecs-cluster-permissions)
aws_elb.rails_frontend: Refreshing state... (ID: rails-frontend)
aws_launch_configuration.ecs_instance: Refreshing state... (ID: ecs-instance-mzxiahkorne3zd24m7nnflrsd4)
aws_autoscaling_group.ecs_cluster_instances: Refreshing state... (ID: ecs-cluster-instances)
aws_elb.sinatra_backend: Refreshing state... (ID: sinatra-backend)
aws_ecs_task_definition.rails_frontend: Refreshing state... (ID: rails-frontend)
aws_ecs_service.rails_frontend: Refreshing state... (ID: arn:aws:ecs:us-east-1:123456789012:service/rails-frontend)
aws_ecs_service.sinatra_backend: Creating...
cluster: "" => "arn:aws:ecs:us-east-1:123456789012:cluster/example-cluster"
deployment_maximum_percent: "" => "200"
deployment_minimum_healthy_percent: "" => "50"
desired_count: "" => "2"
iam_role: "" => "arn:aws:iam::123456789012:role/ecs-service-role"
load_balancer.#: "" => "1"
load_balancer.502737317.container_name: "" => "sinatra-backend"
load_balancer.502737317.container_port: "" => "4567"
load_balancer.502737317.elb_name: "" => "sinatra-backend"
name: "" => "sinatra-backend"
task_definition: "" => "arn:aws:ecs:us-east-1:123456789012:task-definition/sinatra-backend:1"
aws_ecs_service.sinatra_backend: Creation complete
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
The state of your infrastructure has been saved to the path
below. This state is required to modify and destroy your
infrastructure, so keep it safe. To inspect the complete state
use the `terraform show` command.
State path: terraform.tfstate
Outputs:
rails_frontend_url = http://rails-frontend-1972244078.us-east-1.elb.amazonaws.com
sinatra_backend_url = http://internal-sinatra-backend-673555761.us-east-1.elb.amazonaws.com:4567
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment