cloud-init

v1.3.0 published on Thursday, Nov 18, 2021 by Pulumi

getConfig

Renders a multipart 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. Multipart 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 multipart MIME messages. Its featureset is specialized for the features of cloud-init.

Example Usage

using Pulumi;
using CloudInit = Pulumi.CloudInit;

class MyStack : Stack
{
    public MyStack()
    {
        var foo = Output.Create(CloudInit.GetConfig.InvokeAsync(new CloudInit.GetConfigArgs
        {
            Base64Encode = false,
            Gzip = false,
            Parts = 
            {
                new CloudInit.Inputs.GetConfigPartArgs
                {
                    Content = "baz",
                    ContentType = "text/x-shellscript",
                    Filename = "foobar.sh",
                },
            },
        }));
    }

}
package main

import (
	"github.com/pulumi/pulumi-cloudinit/sdk/go/cloudinit"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		opt0 := false
		opt1 := false
		_, err := cloudinit.LookupConfig(ctx, &GetConfigArgs{
			Base64Encode: &opt0,
			Gzip:         &opt1,
			Parts: []GetConfigPart{
				GetConfigPart{
					Content:     "baz",
					ContentType: "text/x-shellscript",
					Filename:    "foobar.sh",
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_cloudinit as cloudinit

foo = cloudinit.get_config(base64_encode=False,
    gzip=False,
    parts=[cloudinit.GetConfigPartArgs(
        content="baz",
        content_type="text/x-shellscript",
        filename="foobar.sh",
    )])
import * as pulumi from "@pulumi/pulumi";
import * as cloudinit from "@pulumi/cloudinit";

const foo = pulumi.output(cloudinit.getConfig({
    base64Encode: false,
    gzip: false,
    parts: [{
        content: "baz",
        contentType: "text/x-shellscript",
        filename: "foobar.sh",
    }],
}));

Coming soon!

Using getConfig

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getConfig(args: GetConfigArgs, opts?: InvokeOptions): Promise<GetConfigResult>
function getConfigOutput(args: GetConfigOutputArgs, opts?: InvokeOptions): Output<GetConfigResult>
def get_config(base64_encode: Optional[bool] = None,
               boundary: Optional[str] = None,
               gzip: Optional[bool] = None,
               parts: Optional[Sequence[GetConfigPart]] = None,
               opts: Optional[InvokeOptions] = None) -> GetConfigResult
def get_config_output(base64_encode: Optional[pulumi.Input[bool]] = None,
               boundary: Optional[pulumi.Input[str]] = None,
               gzip: Optional[pulumi.Input[bool]] = None,
               parts: Optional[pulumi.Input[Sequence[pulumi.Input[GetConfigPartArgs]]]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetConfigResult]
func LookupConfig(ctx *Context, args *LookupConfigArgs, opts ...InvokeOption) (*LookupConfigResult, error)
func LookupConfigOutput(ctx *Context, args *LookupConfigOutputArgs, opts ...InvokeOption) LookupConfigResultOutput

> Note: This function is named LookupConfig in the Go SDK.

public static class GetConfig 
{
    public static Task<GetConfigResult> InvokeAsync(GetConfigArgs args, InvokeOptions? opts = null)
    public static Output<GetConfigResult> Invoke(GetConfigInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetConfigResult> getConfig(GetConfigArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: cloudinit:index/getConfig:getConfig
  arguments:
    # arguments dictionary

The following arguments are supported:

Parts List<Pulumi.CloudInit.Inputs.GetConfigPart>

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.

Base64Encode bool

Base64 encoding of the rendered output. Defaults to true, and cannot be disabled if gzip is true.

Boundary string

Define the Writer's default boundary separator. Defaults to MIMEBOUNDARY.

Gzip bool

Specify whether or not to gzip the rendered output. Defaults to true.

Parts []GetConfigPart

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.

Base64Encode bool

Base64 encoding of the rendered output. Defaults to true, and cannot be disabled if gzip is true.

Boundary string

Define the Writer's default boundary separator. Defaults to MIMEBOUNDARY.

Gzip bool

Specify whether or not to gzip the rendered output. Defaults to true.

parts List<GetConfigPart>

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.

base64Encode Boolean

Base64 encoding of the rendered output. Defaults to true, and cannot be disabled if gzip is true.

boundary String

Define the Writer's default boundary separator. Defaults to MIMEBOUNDARY.

gzip Boolean

Specify whether or not to gzip the rendered output. Defaults to true.

parts GetConfigPart[]

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.

base64Encode boolean

Base64 encoding of the rendered output. Defaults to true, and cannot be disabled if gzip is true.

boundary string

Define the Writer's default boundary separator. Defaults to MIMEBOUNDARY.

gzip boolean

Specify whether or not to gzip the rendered output. Defaults to true.

parts Sequence[GetConfigPart]

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.

base64_encode bool

Base64 encoding of the rendered output. Defaults to true, and cannot be disabled if gzip is true.

boundary str

Define the Writer's default boundary separator. Defaults to MIMEBOUNDARY.

gzip bool

Specify whether or not to gzip the rendered output. Defaults to true.

parts List<Property Map>

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.

base64Encode Boolean

Base64 encoding of the rendered output. Defaults to true, and cannot be disabled if gzip is true.

boundary String

Define the Writer's default boundary separator. Defaults to MIMEBOUNDARY.

gzip Boolean

Specify whether or not to gzip the rendered output. Defaults to true.

getConfig Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Parts List<Pulumi.CloudInit.Outputs.GetConfigPart>
Rendered string

The final rendered multi-part cloud-init config.

Base64Encode bool
Boundary string
Gzip bool
Id string

The provider-assigned unique ID for this managed resource.

Parts []GetConfigPart
Rendered string

The final rendered multi-part cloud-init config.

Base64Encode bool
Boundary string
Gzip bool
id String

The provider-assigned unique ID for this managed resource.

parts List<GetConfigPart>
rendered String

The final rendered multi-part cloud-init config.

base64Encode Boolean
boundary String
gzip Boolean
id string

The provider-assigned unique ID for this managed resource.

parts GetConfigPart[]
rendered string

The final rendered multi-part cloud-init config.

base64Encode boolean
boundary string
gzip boolean
id str

The provider-assigned unique ID for this managed resource.

parts Sequence[GetConfigPart]
rendered str

The final rendered multi-part cloud-init config.

base64_encode bool
boundary str
gzip bool
id String

The provider-assigned unique ID for this managed resource.

parts List<Property Map>
rendered String

The final rendered multi-part cloud-init config.

base64Encode Boolean
boundary String
gzip Boolean

Supporting Types

GetConfigPart

Content string

Body content for the part.

ContentType string

A MIME-style content type to report in the header for the part.

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.

Content string

Body content for the part.

ContentType string

A MIME-style content type to report in the header for the part.

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.

content String

Body content for the part.

contentType String

A MIME-style content type to report in the header for the part.

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.

content string

Body content for the part.

contentType string

A MIME-style content type to report in the header for the part.

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.

content str

Body content for the part.

content_type str

A MIME-style content type to report in the header for the part.

filename str

A filename to report in the header for the part.

merge_type str

A value for the X-Merge-Type header of the part, to control cloud-init merging behavior.

content String

Body content for the part.

contentType String

A MIME-style content type to report in the header for the part.

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.

Package Details

Repository
https://github.com/pulumi/pulumi-cloudinit
License
Apache-2.0
Notes

This Pulumi package is based on the cloudinit Terraform Provider.