Create_before_destroy=false in aws_launch_config doesn't work

I am running the latest version of Terraform 0.12.6.

This seems extremely trivial and I am really confused why it isn’t working. I am setting the create_before_destroy=false for the following launch config but it keeps wanting to create before destroy as indicated in the plan shown below (by the fact that is it +/- instead of -/+).
Resource definition:

resource “aws_launch_configuration” “autoscale_launch_config1” {
name_prefix = “autoscale_launcher-${var.deployment_name}”
image_id = var.ami
instance_type = var.instance_type
security_groups = []
enable_monitoring = true
user_data = file(var.user_data_file_string)
lifecycle {
create_before_destroy = false

Terraform plan:

aws_launch_configuration.autoscale_launch_config1 must be replaced

+/- resource “aws_launch_configuration” “autoscale_launch_config1” {
associate_public_ip_address = false
~ ebs_optimized = false → (known after apply)
enable_monitoring = true
~ id = “autoscale_launcher-CRAIG-Terraform-0downtime-BlueGreen20190821213446641200000005” → (known after apply)
image_id = “ami-07669fc90e6e6cc47”
instance_type = “t2.nano”
+ key_name = (known after apply)
~ name = “autoscale_launcher-CRAIG-Terraform-0downtime-BlueGreen20190821213446641200000005” → (known after apply)
name_prefix = “autoscale_launcher-CRAIG-Terraform-0downtime-BlueGreen”
security_groups = [
~ user_data = “1320dc5063b001e3a33310f4b48be2cd2711a0d6” → “da99307039ff178c1cd0a6b94937b9f6560f05e5” # forces replacement
- vpc_classic_link_security_groups = → null

  + ebs_block_device {
      + delete_on_termination = (known after apply)
      + device_name           = (known after apply)
      + encrypted             = (known after apply)
      + iops                  = (known after apply)
      + no_device             = (known after apply)
      + snapshot_id           = (known after apply)
      + volume_size           = (known after apply)
      + volume_type           = (known after apply)

  + root_block_device {
      + delete_on_termination = (known after apply)
      + iops                  = (known after apply)
      + volume_size           = (known after apply)
      + volume_type           = (known after apply)

Any help as to why this isn’t destroying before creating would be greatly appreciated. Again, I feel it is something very obvious I am missing but i just cannot figure out what. Thank you in advance.

EDIT: This aws_launch_config resource is a trigger in several null resources. Not sure if that would affect anything.

Maybe this might help?

Thanks for your reply. I have already looked through this page in detail, but could not see what my problem is from the information there. Any specific parts you were referring to?

Sorry for being cryptic with the link posting. :smile:

I imagined that using name_prefix automatically meant create_before_destroy set to true .

Thank for the follow-up. I tried using the name field that I would manually change each time and it still creates it before it destroys it instead…:frowning: