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

Removing key_name from launch configs does not trigger an updated launch config. #1676

Open
hashibot opened this issue Sep 15, 2017 · 11 comments
Labels
bug Addresses a defect in current functionality. service/autoscaling Issues and PRs that pertain to the autoscaling service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.

Comments

@hashibot
Copy link

hashibot commented Sep 15, 2017

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


I needed to remove the key_name attached to an instance created by an ASG via a LC.

But running plan showed no change to be made.

Terraform Version

v0.9.5

Affected Resource(s)

Please list the resources as a list, for example:

aws_launch_configuration
Terraform Configuration Files

Actual code block post update. The only change made here was the removal of key_name:

resource "aws_launch_configuration" "triton-as-conf" {
  name_prefix   = "triton-${var.name}-launch-conf"
  image_id      = "${var.container_host_ami}"
  instance_type = "${var.container_host_instance_type}"

  security_groups = [
    "${aws_security_group.ssh.id}",
    "${aws_security_group.web.id}",
    "${aws_security_group.self_reference.id}",
  ]

  user_data            = "${data.template_file.user_data.rendered}"
  iam_instance_profile = "${aws_iam_instance_profile.container_host.name}"

  lifecycle {
    create_before_destroy = true
  }
}

All vars are set.

Inside the launch configs, the only code change was the removal of:

key_name = "${aws_key_pair.deployer.key_name}"

The above var was set but the concept here is that removing key_name does not trigger the LC to change.

Expected Behavior

LC should have been recreated without key_name.

Actual Behavior

Nothing.

Steps to Reproduce

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

terraform apply
Remove the key_name value from launch configs
terraform plan
terraform apply

Seems similar to the issue another user experience with EBS:

hashicorp/terraform#14826

@ChrisF987
Copy link

+1 with terraform v0.11.1

@radeksimko radeksimko added the service/autoscaling Issues and PRs that pertain to the autoscaling service. label Jan 28, 2018
@george-angel
Copy link

george-angel commented Feb 7, 2018

We are seeing the same behaviour with aws_instance resource. Removing key_name or setting it to an empty string, terraform does not see change in configuration and results in no-op run.

As a workaround we taint the affected resources.

@MissStava
Copy link

+1 with terraform v0.11.11, provider.aws v1.60.0

@jvshahid
Copy link

jvshahid commented Mar 2, 2020

We are also seeing the same issue with terraform v0.12.20 and aws provider version v2.49.0

@jwenz723
Copy link

jwenz723 commented Mar 9, 2020

+1 with terraform v0.12.23, provider.aws v2.52.0

@idubinskiy
Copy link
Contributor

Looks like this is related to the Terraform behavior described in hashicorp/terraform#4501. key_name is configured as both Optional and Computed. I'm not sure why key_name was marked as Computed in the first place, but it's possible that simply removing that property will fix this issue.

@github-actions
Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Mar 11, 2022
@george-angel
Copy link

remove stale

@github-actions github-actions bot removed the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Mar 12, 2022
@aitorres
Copy link

aitorres commented Aug 2, 2022

This bug is still happening, is there any proposed fix on Terraform's side?

@jaffel-lc
Copy link

still happens on v1.3.4

Copy link

github-actions bot commented Jan 2, 2025

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/autoscaling Issues and PRs that pertain to the autoscaling service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.
Projects
None yet
Development

No branches or pull requests

10 participants