cloudinit_config (Data Source)

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 user_data 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
from constructs import Construct
from cdktf import Fn, Token, TerraformStack
#
# Provider bindings are generated by running `cdktf get`.
# See https://cdk.tf/provider-generation for more details.
#
from imports.cloudinit.data_cloudinit_config import DataCloudinitConfig
class MyConvertedCode(TerraformStack):
    def __init__(self, scope, name):
        super().__init__(scope, name)
        DataCloudinitConfig(self, "foobar",
            base64_encode=False,
            gzip=False,
            part=[DataCloudinitConfigPart(
                content=Token.as_string(Fn.file("${path.module}/hello-script.sh")),
                content_type="text/x-shellscript",
                filename="hello-script.sh"
            ), DataCloudinitConfigPart(
                content=Token.as_string(Fn.file("${path.module}/cloud-config.yaml")),
                content_type="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: