HostedConfigurationVersion class

Provides an AppConfig Hosted Configuration Version resource.

Example Usage

Freeform

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.appconfig.HostedConfigurationVersion("example", {
    applicationId: exampleAwsAppconfigApplication.id,
    configurationProfileId: exampleAwsAppconfigConfigurationProfile.configurationProfileId,
    description: "Example Freeform Hosted Configuration Version",
    contentType: "application/json",
    content: JSON.stringify({
        foo: "bar",
        fruit: [
            "apple",
            "pear",
            "orange",
        ],
        isThingEnabled: true,
    }),
});
import pulumi
import json
import pulumi_aws as aws

example = aws.appconfig.HostedConfigurationVersion("example",
    application_id=example_aws_appconfig_application["id"],
    configuration_profile_id=example_aws_appconfig_configuration_profile["configurationProfileId"],
    description="Example Freeform Hosted Configuration Version",
    content_type="application/json",
    content=json.dumps({
        "foo": "bar",
        "fruit": [
            "apple",
            "pear",
            "orange",
        ],
        "isThingEnabled": True,
    }))
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.AppConfig.HostedConfigurationVersion("example", new()
    {
        ApplicationId = exampleAwsAppconfigApplication.Id,
        ConfigurationProfileId = exampleAwsAppconfigConfigurationProfile.ConfigurationProfileId,
        Description = "Example Freeform Hosted Configuration Version",
        ContentType = "application/json",
        Content = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["foo"] = "bar",
            ["fruit"] = new[]
            {
                "apple",
                "pear",
                "orange",
            },
            ["isThingEnabled"] = true,
        }),
    });

});
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/appconfig"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"foo": "bar",
			"fruit": []string{
				"apple",
				"pear",
				"orange",
			},
			"isThingEnabled": true,
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		_, err = appconfig.NewHostedConfigurationVersion(ctx, "example", &appconfig.HostedConfigurationVersionArgs{
			ApplicationId:          pulumi.Any(exampleAwsAppconfigApplication.Id),
			ConfigurationProfileId: pulumi.Any(exampleAwsAppconfigConfigurationProfile.ConfigurationProfileId),
			Description:            pulumi.String("Example Freeform Hosted Configuration Version"),
			ContentType:            pulumi.String("application/json"),
			Content:                pulumi.String(json0),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_appconfig_hostedconfigurationversion" "example" {
  application_id           = exampleAwsAppconfigApplication.id
  configuration_profile_id = exampleAwsAppconfigConfigurationProfile.configurationProfileId
  description              = "Example Freeform Hosted Configuration Version"
  content_type             = "application/json"
  content = jsonencode({
    "foo"            = "bar"
    "fruit"          = ["apple", "pear", "orange"]
    "isThingEnabled" = true
  })
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.appconfig.HostedConfigurationVersion;
import com.pulumi.aws.appconfig.HostedConfigurationVersionArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new HostedConfigurationVersion("example", HostedConfigurationVersionArgs.builder()
            .applicationId(exampleAwsAppconfigApplication.id())
            .configurationProfileId(exampleAwsAppconfigConfigurationProfile.configurationProfileId())
            .description("Example Freeform Hosted Configuration Version")
            .contentType("application/json")
            .content(serializeJson(
                jsonObject(
                    jsonProperty("foo", "bar"),
                    jsonProperty("fruit", jsonArray(
                        "apple",
                        "pear",
                        "orange"
                    )),
                    jsonProperty("isThingEnabled", true)
                )))
            .build());

    }
}
resources:
  example:
    type: aws:appconfig:HostedConfigurationVersion
    properties:
      applicationId: ${exampleAwsAppconfigApplication.id}
      configurationProfileId: ${exampleAwsAppconfigConfigurationProfile.configurationProfileId}
      description: Example Freeform Hosted Configuration Version
      contentType: application/json
      content:
        fn::toJSON:
          foo: bar
          fruit:
            - apple
            - pear
            - orange
          isThingEnabled: true

Feature Flags

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.appconfig.HostedConfigurationVersion("example", {
    applicationId: exampleAwsAppconfigApplication.id,
    configurationProfileId: exampleAwsAppconfigConfigurationProfile.configurationProfileId,
    description: "Example Feature Flag Configuration Version",
    contentType: "application/json",
    content: JSON.stringify({
        flags: {
            foo: {
                name: "foo",
                _deprecation: {
                    status: "planned",
                },
            },
            bar: {
                name: "bar",
                attributes: {
                    someAttribute: {
                        constraints: {
                            type: "string",
                            required: true,
                        },
                    },
                    someOtherAttribute: {
                        constraints: {
                            type: "number",
                            required: true,
                        },
                    },
                },
            },
        },
        values: {
            foo: {
                enabled: "true",
            },
            bar: {
                enabled: "true",
                someAttribute: "Hello World",
                someOtherAttribute: 123,
            },
        },
        version: "1",
    }),
});
import pulumi
import json
import pulumi_aws as aws

example = aws.appconfig.HostedConfigurationVersion("example",
    application_id=example_aws_appconfig_application["id"],
    configuration_profile_id=example_aws_appconfig_configuration_profile["configurationProfileId"],
    description="Example Feature Flag Configuration Version",
    content_type="application/json",
    content=json.dumps({
        "flags": {
            "foo": {
                "name": "foo",
                "_deprecation": {
                    "status": "planned",
                },
            },
            "bar": {
                "name": "bar",
                "attributes": {
                    "someAttribute": {
                        "constraints": {
                            "type": "string",
                            "required": True,
                        },
                    },
                    "someOtherAttribute": {
                        "constraints": {
                            "type": "number",
                            "required": True,
                        },
                    },
                },
            },
        },
        "values": {
            "foo": {
                "enabled": "true",
            },
            "bar": {
                "enabled": "true",
                "someAttribute": "Hello World",
                "someOtherAttribute": 123,
            },
        },
        "version": "1",
    }))
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.AppConfig.HostedConfigurationVersion("example", new()
    {
        ApplicationId = exampleAwsAppconfigApplication.Id,
        ConfigurationProfileId = exampleAwsAppconfigConfigurationProfile.ConfigurationProfileId,
        Description = "Example Feature Flag Configuration Version",
        ContentType = "application/json",
        Content = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["flags"] = new Dictionary<string, object?>
            {
                ["foo"] = new Dictionary<string, object?>
                {
                    ["name"] = "foo",
                    ["_deprecation"] = new Dictionary<string, object?>
                    {
                        ["status"] = "planned",
                    },
                },
                ["bar"] = new Dictionary<string, object?>
                {
                    ["name"] = "bar",
                    ["attributes"] = new Dictionary<string, object?>
                    {
                        ["someAttribute"] = new Dictionary<string, object?>
                        {
                            ["constraints"] = new Dictionary<string, object?>
                            {
                                ["type"] = "string",
                                ["required"] = true,
                            },
                        },
                        ["someOtherAttribute"] = new Dictionary<string, object?>
                        {
                            ["constraints"] = new Dictionary<string, object?>
                            {
                                ["type"] = "number",
                                ["required"] = true,
                            },
                        },
                    },
                },
            },
            ["values"] = new Dictionary<string, object?>
            {
                ["foo"] = new Dictionary<string, object?>
                {
                    ["enabled"] = "true",
                },
                ["bar"] = new Dictionary<string, object?>
                {
                    ["enabled"] = "true",
                    ["someAttribute"] = "Hello World",
                    ["someOtherAttribute"] = 123,
                },
            },
            ["version"] = "1",
        }),
    });

});
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/appconfig"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"flags": map[string]map[string]interface{}{
				"foo": map[string]interface{}{
					"name": "foo",
					"_deprecation": map[string]string{
						"status": "planned",
					},
				},
				"bar": map[string]interface{}{
					"name": "bar",
					"attributes": map[string]map[string]map[string]interface{}{
						"someAttribute": map[string]map[string]interface{}{
							"constraints": map[string]interface{}{
								"type":     "string",
								"required": true,
							},
						},
						"someOtherAttribute": map[string]map[string]interface{}{
							"constraints": map[string]interface{}{
								"type":     "number",
								"required": true,
							},
						},
					},
				},
			},
			"values": map[string]interface{}{
				"foo": map[string]string{
					"enabled": "true",
				},
				"bar": map[string]interface{}{
					"enabled":            "true",
					"someAttribute":      "Hello World",
					"someOtherAttribute": 123,
				},
			},
			"version": "1",
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		_, err = appconfig.NewHostedConfigurationVersion(ctx, "example", &appconfig.HostedConfigurationVersionArgs{
			ApplicationId:          pulumi.Any(exampleAwsAppconfigApplication.Id),
			ConfigurationProfileId: pulumi.Any(exampleAwsAppconfigConfigurationProfile.ConfigurationProfileId),
			Description:            pulumi.String("Example Feature Flag Configuration Version"),
			ContentType:            pulumi.String("application/json"),
			Content:                pulumi.String(json0),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_appconfig_hostedconfigurationversion" "example" {
  application_id           = exampleAwsAppconfigApplication.id
  configuration_profile_id = exampleAwsAppconfigConfigurationProfile.configurationProfileId
  description              = "Example Feature Flag Configuration Version"
  content_type             = "application/json"
  content = jsonencode({
    "flags" = {
      "foo" = {
        "name" = "foo"
        "_deprecation" = {
          "status" = "planned"
        }
      }
      "bar" = {
        "name" = "bar"
        "attributes" = {
          "someAttribute" = {
            "constraints" = {
              "type"     = "string"
              "required" = true
            }
          }
          "someOtherAttribute" = {
            "constraints" = {
              "type"     = "number"
              "required" = true
            }
          }
        }
      }
    }
    "values" = {
      "foo" = {
        "enabled" = "true"
      }
      "bar" = {
        "enabled"            = "true"
        "someAttribute"      = "Hello World"
        "someOtherAttribute" = 123
      }
    }
    "version" = "1"
  })
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.appconfig.HostedConfigurationVersion;
import com.pulumi.aws.appconfig.HostedConfigurationVersionArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new HostedConfigurationVersion("example", HostedConfigurationVersionArgs.builder()
            .applicationId(exampleAwsAppconfigApplication.id())
            .configurationProfileId(exampleAwsAppconfigConfigurationProfile.configurationProfileId())
            .description("Example Feature Flag Configuration Version")
            .contentType("application/json")
            .content(serializeJson(
                jsonObject(
                    jsonProperty("flags", jsonObject(
                        jsonProperty("foo", jsonObject(
                            jsonProperty("name", "foo"),
                            jsonProperty("_deprecation", jsonObject(
                                jsonProperty("status", "planned")
                            ))
                        )),
                        jsonProperty("bar", jsonObject(
                            jsonProperty("name", "bar"),
                            jsonProperty("attributes", jsonObject(
                                jsonProperty("someAttribute", jsonObject(
                                    jsonProperty("constraints", jsonObject(
                                        jsonProperty("type", "string"),
                                        jsonProperty("required", true)
                                    ))
                                )),
                                jsonProperty("someOtherAttribute", jsonObject(
                                    jsonProperty("constraints", jsonObject(
                                        jsonProperty("type", "number"),
                                        jsonProperty("required", true)
                                    ))
                                ))
                            ))
                        ))
                    )),
                    jsonProperty("values", jsonObject(
                        jsonProperty("foo", jsonObject(
                            jsonProperty("enabled", "true")
                        )),
                        jsonProperty("bar", jsonObject(
                            jsonProperty("enabled", "true"),
                            jsonProperty("someAttribute", "Hello World"),
                            jsonProperty("someOtherAttribute", 123)
                        ))
                    )),
                    jsonProperty("version", "1")
                )))
            .build());

    }
}
resources:
  example:
    type: aws:appconfig:HostedConfigurationVersion
    properties:
      applicationId: ${exampleAwsAppconfigApplication.id}
      configurationProfileId: ${exampleAwsAppconfigConfigurationProfile.configurationProfileId}
      description: Example Feature Flag Configuration Version
      contentType: application/json
      content:
        fn::toJSON:
          flags:
            foo:
              name: foo
              _deprecation:
                status: planned
            bar:
              name: bar
              attributes:
                someAttribute:
                  constraints:
                    type: string
                    required: true
                someOtherAttribute:
                  constraints:
                    type: number
                    required: true
          values:
            foo:
              enabled: 'true'
            bar:
              enabled: 'true'
              someAttribute: Hello World
              someOtherAttribute: 123
          version: '1'

Multi-variant Feature Flags

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as std from "@pulumi/std";

const example = new aws.appconfig.HostedConfigurationVersion("example", {
    applicationId: exampleAwsAppconfigApplication.id,
    configurationProfileId: exampleAwsAppconfigConfigurationProfile.configurationProfileId,
    description: "Example Multi-variant Feature Flag Configuration Version",
    contentType: "application/json",
    content: JSON.stringify({
        flags: {
            loggingenabled: {
                name: "loggingEnabled",
            },
        },
        values: {
            loggingenabled: {
                _variants: std.concat({
                    input: [
                        .map(userId => ({
                            enabled: true,
                            name: `usersWithLoggingEnabled_${userId}`,
                            rule: `(or (eq $userId "${userId}"))`,
                        })),
                        [{
                            enabled: false,
                            name: "Default",
                        }],
                    ],
                }).then(invoke => invoke.result),
            },
        },
        version: "1",
    }),
});
import pulumi
import json
import pulumi_aws as aws
import pulumi_std as std

example = aws.appconfig.HostedConfigurationVersion("example",
    application_id=example_aws_appconfig_application["id"],
    configuration_profile_id=example_aws_appconfig_configuration_profile["configurationProfileId"],
    description="Example Multi-variant Feature Flag Configuration Version",
    content_type="application/json",
    content=json.dumps({
        "flags": {
            "loggingenabled": {
                "name": "loggingEnabled",
            },
        },
        "values": {
            "loggingenabled": {
                "_variants": std.concat(input=[
                    [{
                        "enabled": True,
                        "name": f"usersWithLoggingEnabled_{user_id}",
                        "rule": f"(or (eq $userId \"{user_id}\"))",
                    } for userId in appcfg_enable_logging_user_ids],
                    [{
                        "enabled": False,
                        "name": "Default",
                    }],
                ]).result,
            },
        },
        "version": "1",
    }))
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;
using Std = Pulumi.Std;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.AppConfig.HostedConfigurationVersion("example", new()
    {
        ApplicationId = exampleAwsAppconfigApplication.Id,
        ConfigurationProfileId = exampleAwsAppconfigConfigurationProfile.ConfigurationProfileId,
        Description = "Example Multi-variant Feature Flag Configuration Version",
        ContentType = "application/json",
        Content = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["flags"] = new Dictionary<string, object?>
            {
                ["loggingenabled"] = new Dictionary<string, object?>
                {
                    ["name"] = "loggingEnabled",
                },
            },
            ["values"] = new Dictionary<string, object?>
            {
                ["loggingenabled"] = new Dictionary<string, object?>
                {
                    ["_variants"] = Std.Concat.Invoke(new()
                    {
                        Input = new[]
                        {
                            .Select(userId =>
                            {
                                return
                                {
                                    { "enabled", true },
                                    { "name", $"usersWithLoggingEnabled_{userId}" },
                                    { "rule", $"(or (eq $userId \"{userId}\"))" },
                                };
                            }).ToList(),
                            new[]
                            {

                                {
                                    { "enabled", false },
                                    { "name", "Default" },
                                },
                            },
                        },
                    }).Apply(invoke => invoke.Result),
                },
            },
            ["version"] = "1",
        }),
    });

});
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
    std = {
      source = "pulumi/std"
    }
  }
}

data "std_concat" "invoke_0" {
  input = [[for userId in appcfgEnableLoggingUserIds : {
    "enabled" = true
    "name"    ="usersWithLoggingEnabled_${userId}"
    "rule"    ="(or (eq $userId "${userId}"))"
    } ], [{
    "enabled" = false
    "name"    = "Default"
  }]]
}

resource "aws_appconfig_hostedconfigurationversion" "example" {
  application_id           = exampleAwsAppconfigApplication.id
  configuration_profile_id = exampleAwsAppconfigConfigurationProfile.configurationProfileId
  description              = "Example Multi-variant Feature Flag Configuration Version"
  content_type             = "application/json"
  content = jsonencode({
    "flags" = {
      "loggingenabled" = {
        "name" = "loggingEnabled"
      }
    }
    "values" = {
      "loggingenabled" = {
        "_variants" = data.std_concat.invoke_0.result
      }
    }
    "version" = "1"
  })
}

Import

Using pulumi import, import AppConfig Hosted Configuration Versions using the application ID, configuration profile ID, and version number separated by a slash (/). For example:

$ pulumi import aws:appconfig/hostedConfigurationVersion:HostedConfigurationVersion example 71abcde/11xxxxx/2

Constructors

HostedConfigurationVersion(String name, {HostedConfigurationVersionArgs? args, CustomResourceOptions? options})
Creates a new HostedConfigurationVersion. name The Pulumi resource name. args Arguments used to configure this HostedConfigurationVersion. The set of arguments for HostedConfigurationVersion. options Resource options controlling this resource's behavior.
HostedConfigurationVersion.reference(String urn)
Creates a typed reference to an existing HostedConfigurationVersion resource.

Properties

applicationId ↔ Output<String>
Application ID.
latefinal
arn ↔ Output<String>
ARN of the AppConfig hosted configuration version.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
configurationProfileId ↔ Output<String>
Configuration profile ID.
latefinal
content ↔ Output<String>
Content of the configuration or the configuration data.
latefinal
contentType ↔ Output<String>
Standard MIME type describing the format of the configuration content. For more information, see Content-Type.
latefinal
description ↔ Output<String?>
Description of the configuration.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited
versionNumber ↔ Output<int>
Version number of the hosted configuration.
latefinal

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {HostedConfigurationVersionState? state, CustomResourceOptions? options}) → HostedConfigurationVersion
Gets an existing HostedConfigurationVersion resource's state with the given name and id.