Skip to content

Unrecoverable state if you delete a Launch Template by hand #5965

Closed
@ghost

Description

This issue was originally opened by @kvz as hashicorp/terraform#18931. It was migrated here as a result of the provider split. The original body of the issue is below.


Terraform Version

Terraform v0.11.8'

Terraform Configuration Files

An aws_launch_template used in an aws_autoscaling_group.

Expected Behavior

I noticed some local changes weren't propagating to the Launch Template (this was odd in itself), so
I deleted the Launch Template by hand, and ran Terraform plan, expecting that Terraform would spot a difference between actual & expected state and that it would be recreate a Launch Template with my new settings.

Actual Behavior

At the refresh stage, Terraform errors out:

Error: Error refreshing state: 1 error(s) occurred:

* module.region_euwest2.module.crossover.aws_launch_template.crossover: 1 error(s) occurred:

* module.region_euwest2.module.crossover.aws_launch_template.crossover: aws_launch_template.crossover: Error getting launch template: InvalidLaunchTemplateId.NotFound: Atleast one of the launch templates specified in the request does not exist.
	status code: 400, request id: e321a45b-f359-40b5-9d18-dea9ed9100c2

So I got in an unrecoverable state because refresh is a prerequisite for changes, destroys, launches (I think). I manually removed the Launch Template and any reference to it from the tfstate json, and then I was on my way again.

Activity

added
bugAddresses a defect in current functionality.
service/ec2Issues and PRs that pertain to the ec2 service.
on Sep 24, 2018
bflad

bflad commented on Sep 24, 2018

@bflad
Contributor

Hi @kvz 👋 Sorry you ran into trouble with this. I have submitted a bug fix pull request to properly handle this situation with a verifying acceptance test: #5967

kvz

kvz commented on Sep 24, 2018

@kvz

Wow that's really fast, amazing @bflad! 🎉

added this to the v1.38.0 milestone on Sep 26, 2018
bflad

bflad commented on Sep 26, 2018

@bflad
Contributor

The fix for this has been merged and will release with version 1.38.0 of the AWS provider, likely later today.

bflad

bflad commented on Sep 26, 2018

@bflad
Contributor

This has been released in version 1.38.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

ghost
ghost locked and limited conversation to collaborators on Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAddresses a defect in current functionality.service/ec2Issues and PRs that pertain to the ec2 service.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Unrecoverable state if you delete a Launch Template by hand · Issue #5965 · hashicorp/terraform-provider-aws