From 1df3297601cc4530fef9b4f9c07e96dcec7c6233 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 24 Jun 2014 10:15:08 -0700 Subject: [PATCH] providers/aws: if terminated, no longer exists --- builtin/providers/aws/resources.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/builtin/providers/aws/resources.go b/builtin/providers/aws/resources.go index a93eab8684..df49ad0050 100644 --- a/builtin/providers/aws/resources.go +++ b/builtin/providers/aws/resources.go @@ -89,6 +89,12 @@ func resource_aws_instance_refresh( } instance := &resp.Reservations[0].Instances[0] + + // If the instance is terminated, then it is gone + if instance.State.Name == "terminated" { + return nil, nil + } + return resource_aws_instance_update_state(s, instance) }