← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1902482] [NEW] Terraform template_cloudinit_config multiple part execution order is wrong

 

Public bug reported:

I am using the terraform to build my ec2-instances as part of instance
bootstrap, added cloud-init config to run multiple userdata scripts. but
the content_type = "text/x-shellscript" always executed first. I
verified the cat /var/log/cloud-init-output.log file. it shows the shell
script is invoked first. How do I config the shell script to run at
last?

data "template_cloudinit_config" "myapp_cloudinit_config" {
  gzip = false
  base64_encode = false

  # Main cloud-config configuration file.
  part {
    content_type = "text/cloud-config" 
    content = "${data.template_file.base_bootstrap_file.rendered}" 
    merge_type = "list(append)+dict(recurse_array)+str()"
  }
  part {
    content_type = "text/cloud-config"
    content = "${module.template_file_appsec_init.appsec_user_data_rendered}"
    merge_type = "list(append)+dict(recurse_array)+str()"
  }

  part {
    content_type = "text/x-shellscript"
    content = "${module.template_file_beat_init.beat_user_data_rendered}"
  }
}

Cloud provider: AWS
OS : RHEL 8.2
cloud-init --version: /usr/bin/cloud-init 19.4
Terraform v0.11.8

** Affects: cloud-init
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1902482

Title:
  Terraform template_cloudinit_config multiple part execution order is
  wrong

Status in cloud-init:
  New

Bug description:
  I am using the terraform to build my ec2-instances as part of instance
  bootstrap, added cloud-init config to run multiple userdata scripts.
  but the content_type = "text/x-shellscript" always executed first. I
  verified the cat /var/log/cloud-init-output.log file. it shows the
  shell script is invoked first. How do I config the shell script to run
  at last?

  data "template_cloudinit_config" "myapp_cloudinit_config" {
    gzip = false
    base64_encode = false

    # Main cloud-config configuration file.
    part {
      content_type = "text/cloud-config" 
      content = "${data.template_file.base_bootstrap_file.rendered}" 
      merge_type = "list(append)+dict(recurse_array)+str()"
    }
    part {
      content_type = "text/cloud-config"
      content = "${module.template_file_appsec_init.appsec_user_data_rendered}"
      merge_type = "list(append)+dict(recurse_array)+str()"
    }

    part {
      content_type = "text/x-shellscript"
      content = "${module.template_file_beat_init.beat_user_data_rendered}"
    }
  }

  Cloud provider: AWS
  OS : RHEL 8.2
  cloud-init --version: /usr/bin/cloud-init 19.4
  Terraform v0.11.8

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1902482/+subscriptions