cloudinit_config (Resource)

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.

Example Usage

Config

// 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 { Config } from "./.gen/providers/cloudinit/config";
class MyConvertedCode extends TerraformStack {
  constructor(scope: Construct, name: string) {
    super(scope, name);
    new Config(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",
        },
      ],
    });
  }
}

hello-script.sh

#!/bin/sh
echo "Hello World! I'm starting up now at $(date -R)!"

cloud-config.yaml

#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

Schema

Required

Optional

Read-Only

Nested Schema for part

Required:

Optional: