Renders a multi-part MIME configuration for use with cloud-init.
Cloud-init is a commonly-used startup configuration utility for cloud compute instances. It accepts configuration via provider-specific user data mechanisms, such as userData
for Amazon EC2 instances. Multi-part MIME is one of the data formats it accepts. For more information, see User-Data Formats in the cloud-init manual.
This is not a generalized utility for producing multi-part MIME messages. It's feature set is specialized for cloud-init multi-part MIME messages.
// DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug
import { Construct } from "constructs";
import { Fn, Token, TerraformStack } from "cdktf";
/*
* Provider bindings are generated by running `cdktf get`.
* See https://cdk.tf/provider-generation for more details.
*/
import { DataCloudinitConfig } from "./.gen/providers/cloudinit/data-cloudinit-config";
class MyConvertedCode extends TerraformStack {
constructor(scope: Construct, name: string) {
super(scope, name);
new DataCloudinitConfig(this, "foobar", {
base64Encode: false,
gzip: false,
part: [
{
content: Token.asString(Fn.file("${path.module}/hello-script.sh")),
contentType: "text/x-shellscript",
filename: "hello-script.sh",
},
{
content: Token.asString(Fn.file("${path.module}/cloud-config.yaml")),
contentType: "text/cloud-config",
filename: "cloud-config.yaml",
},
],
});
}
}
#!/bin/sh
echo "Hello World! I'm starting up now at $(date -R)!"
#cloud-config
# See documentation for more configuration examples
# https://cloudinit.readthedocs.io/en/latest/reference/examples.html
# Install arbitrary packages
# https://cloudinit.readthedocs.io/en/latest/reference/examples.html#install-arbitrary-packages
packages:
- python
# Run commands on first boot
# https://cloudinit.readthedocs.io/en/latest/reference/examples.html#run-commands-on-first-boot
runcmd:
- [ ls, -l, / ]
- [ sh, -xc, "echo $(date) ': hello world!'" ]
- [ sh, -c, echo "=========hello world=========" ]
- ls -l /root
part
(Block List) A nested block type which adds a file to the generated cloud-init configuration. Use multiple part
blocks to specify multiple files, which will be included in order of declaration in the final MIME document. (see below for nested schema)base64Encode
(Boolean) Specify whether or not to base64 encode the rendered
output. Defaults to true
, and cannot be disabled if gzip is true
.boundary
(String) Specify the Writer's default boundary separator. Defaults to MIMEBOUNDARY
.gzip
(Boolean) Specify whether or not to gzip the rendered
output. Defaults to true
.id
(String) CRC-32 checksum of rendered
cloud-init config.rendered
(String) The final rendered multi-part cloud-init config.part
Required:
content
(String) Body content for the part.Optional:
contentType
(String) A MIME-style content type to report in the header for the part. Defaults to text/plain
filename
(String) A filename to report in the header for the part.mergeType
(String) A value for the X-Merge-Type
header of the part, to control cloud-init merging behavior.