1. Packages
  2. Alicloud Provider
  3. API Docs
  4. sae
  5. ConfigMap
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

alicloud.sae.ConfigMap

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

    Provides a Serverless App Engine (SAE) Config Map resource.

    For information about Serverless App Engine (SAE) Config Map and how to use it, see What is Config Map.

    NOTE: Available since v1.130.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    import * as random from "@pulumi/random";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tf-example";
    const default = alicloud.getRegions({
        current: true,
    });
    const defaultInteger = new random.index.Integer("default", {
        max: 99999,
        min: 10000,
    });
    const defaultNamespace = new alicloud.sae.Namespace("default", {
        namespaceId: _default.then(_default => `${_default.regions?.[0]?.id}:example${defaultInteger.result}`),
        namespaceName: name,
        namespaceDescription: name,
        enableMicroRegistration: false,
    });
    const defaultConfigMap = new alicloud.sae.ConfigMap("default", {
        data: JSON.stringify({
            "env.home": "/root",
            "env.shell": "/bin/sh",
        }),
        name: name,
        namespaceId: defaultNamespace.namespaceId,
    });
    
    import pulumi
    import json
    import pulumi_alicloud as alicloud
    import pulumi_random as random
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf-example"
    default = alicloud.get_regions(current=True)
    default_integer = random.index.Integer("default",
        max=99999,
        min=10000)
    default_namespace = alicloud.sae.Namespace("default",
        namespace_id=f"{default.regions[0].id}:example{default_integer['result']}",
        namespace_name=name,
        namespace_description=name,
        enable_micro_registration=False)
    default_config_map = alicloud.sae.ConfigMap("default",
        data=json.dumps({
            "env.home": "/root",
            "env.shell": "/bin/sh",
        }),
        name=name,
        namespace_id=default_namespace.namespace_id)
    
    package main
    
    import (
    	"encoding/json"
    	"fmt"
    
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/sae"
    	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "tf-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_default, err := alicloud.GetRegions(ctx, &alicloud.GetRegionsArgs{
    			Current: pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		defaultInteger, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
    			Max: 99999,
    			Min: 10000,
    		})
    		if err != nil {
    			return err
    		}
    		defaultNamespace, err := sae.NewNamespace(ctx, "default", &sae.NamespaceArgs{
    			NamespaceId:             pulumi.Sprintf("%v:example%v", _default.Regions[0].Id, defaultInteger.Result),
    			NamespaceName:           pulumi.String(name),
    			NamespaceDescription:    pulumi.String(name),
    			EnableMicroRegistration: pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		tmpJSON0, err := json.Marshal(map[string]interface{}{
    			"env.home":  "/root",
    			"env.shell": "/bin/sh",
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		_, err = sae.NewConfigMap(ctx, "default", &sae.ConfigMapArgs{
    			Data:        pulumi.String(json0),
    			Name:        pulumi.String(name),
    			NamespaceId: defaultNamespace.NamespaceId,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    using Random = Pulumi.Random;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tf-example";
        var @default = AliCloud.GetRegions.Invoke(new()
        {
            Current = true,
        });
    
        var defaultInteger = new Random.Index.Integer("default", new()
        {
            Max = 99999,
            Min = 10000,
        });
    
        var defaultNamespace = new AliCloud.Sae.Namespace("default", new()
        {
            NamespaceId = @default.Apply(@default => $"{@default.Apply(getRegionsResult => getRegionsResult.Regions[0]?.Id)}:example{defaultInteger.Result}"),
            NamespaceName = name,
            NamespaceDescription = name,
            EnableMicroRegistration = false,
        });
    
        var defaultConfigMap = new AliCloud.Sae.ConfigMap("default", new()
        {
            Data = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["env.home"] = "/root",
                ["env.shell"] = "/bin/sh",
            }),
            Name = name,
            NamespaceId = defaultNamespace.NamespaceId,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.AlicloudFunctions;
    import com.pulumi.alicloud.inputs.GetRegionsArgs;
    import com.pulumi.random.integer;
    import com.pulumi.random.IntegerArgs;
    import com.pulumi.alicloud.sae.Namespace;
    import com.pulumi.alicloud.sae.NamespaceArgs;
    import com.pulumi.alicloud.sae.ConfigMap;
    import com.pulumi.alicloud.sae.ConfigMapArgs;
    import static com.pulumi.codegen.internal.Serialization.*;
    import java.util.List;
    import java.util.ArrayList;
    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) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("tf-example");
            final var default = AlicloudFunctions.getRegions(GetRegionsArgs.builder()
                .current(true)
                .build());
    
            var defaultInteger = new Integer("defaultInteger", IntegerArgs.builder()
                .max(99999)
                .min(10000)
                .build());
    
            var defaultNamespace = new Namespace("defaultNamespace", NamespaceArgs.builder()
                .namespaceId(String.format("%s:example%s", default_.regions()[0].id(),defaultInteger.result()))
                .namespaceName(name)
                .namespaceDescription(name)
                .enableMicroRegistration(false)
                .build());
    
            var defaultConfigMap = new ConfigMap("defaultConfigMap", ConfigMapArgs.builder()
                .data(serializeJson(
                    jsonObject(
                        jsonProperty("env.home", "/root"),
                        jsonProperty("env.shell", "/bin/sh")
                    )))
                .name(name)
                .namespaceId(defaultNamespace.namespaceId())
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tf-example
    resources:
      defaultInteger:
        type: random:integer
        name: default
        properties:
          max: 99999
          min: 10000
      defaultNamespace:
        type: alicloud:sae:Namespace
        name: default
        properties:
          namespaceId: ${default.regions[0].id}:example${defaultInteger.result}
          namespaceName: ${name}
          namespaceDescription: ${name}
          enableMicroRegistration: false
      defaultConfigMap:
        type: alicloud:sae:ConfigMap
        name: default
        properties:
          data:
            fn::toJSON:
              env.home: /root
              env.shell: /bin/sh
          name: ${name}
          namespaceId: ${defaultNamespace.namespaceId}
    variables:
      default:
        fn::invoke:
          Function: alicloud:getRegions
          Arguments:
            current: true
    

    Create ConfigMap Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ConfigMap(name: string, args: ConfigMapArgs, opts?: CustomResourceOptions);
    @overload
    def ConfigMap(resource_name: str,
                  args: ConfigMapArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def ConfigMap(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  data: Optional[str] = None,
                  namespace_id: Optional[str] = None,
                  description: Optional[str] = None,
                  name: Optional[str] = None)
    func NewConfigMap(ctx *Context, name string, args ConfigMapArgs, opts ...ResourceOption) (*ConfigMap, error)
    public ConfigMap(string name, ConfigMapArgs args, CustomResourceOptions? opts = null)
    public ConfigMap(String name, ConfigMapArgs args)
    public ConfigMap(String name, ConfigMapArgs args, CustomResourceOptions options)
    
    type: alicloud:sae:ConfigMap
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ConfigMapArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ConfigMapArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ConfigMapArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ConfigMapArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ConfigMapArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var configMapResource = new AliCloud.Sae.ConfigMap("configMapResource", new()
    {
        Data = "string",
        NamespaceId = "string",
        Description = "string",
        Name = "string",
    });
    
    example, err := sae.NewConfigMap(ctx, "configMapResource", &sae.ConfigMapArgs{
    	Data:        pulumi.String("string"),
    	NamespaceId: pulumi.String("string"),
    	Description: pulumi.String("string"),
    	Name:        pulumi.String("string"),
    })
    
    var configMapResource = new ConfigMap("configMapResource", ConfigMapArgs.builder()
        .data("string")
        .namespaceId("string")
        .description("string")
        .name("string")
        .build());
    
    config_map_resource = alicloud.sae.ConfigMap("configMapResource",
        data="string",
        namespace_id="string",
        description="string",
        name="string")
    
    const configMapResource = new alicloud.sae.ConfigMap("configMapResource", {
        data: "string",
        namespaceId: "string",
        description: "string",
        name: "string",
    });
    
    type: alicloud:sae:ConfigMap
    properties:
        data: string
        description: string
        name: string
        namespaceId: string
    

    ConfigMap Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The ConfigMap resource accepts the following input properties:

    Data string
    ConfigMap instance data.
    NamespaceId string
    The NamespaceId of ConfigMap.It can contain 2 to 32 lowercase characters.The value is in format {RegionId}:{namespace}
    Description string
    The Description of ConfigMap.
    Name string
    ConfigMap instance name.
    Data string
    ConfigMap instance data.
    NamespaceId string
    The NamespaceId of ConfigMap.It can contain 2 to 32 lowercase characters.The value is in format {RegionId}:{namespace}
    Description string
    The Description of ConfigMap.
    Name string
    ConfigMap instance name.
    data String
    ConfigMap instance data.
    namespaceId String
    The NamespaceId of ConfigMap.It can contain 2 to 32 lowercase characters.The value is in format {RegionId}:{namespace}
    description String
    The Description of ConfigMap.
    name String
    ConfigMap instance name.
    data string
    ConfigMap instance data.
    namespaceId string
    The NamespaceId of ConfigMap.It can contain 2 to 32 lowercase characters.The value is in format {RegionId}:{namespace}
    description string
    The Description of ConfigMap.
    name string
    ConfigMap instance name.
    data str
    ConfigMap instance data.
    namespace_id str
    The NamespaceId of ConfigMap.It can contain 2 to 32 lowercase characters.The value is in format {RegionId}:{namespace}
    description str
    The Description of ConfigMap.
    name str
    ConfigMap instance name.
    data String
    ConfigMap instance data.
    namespaceId String
    The NamespaceId of ConfigMap.It can contain 2 to 32 lowercase characters.The value is in format {RegionId}:{namespace}
    description String
    The Description of ConfigMap.
    name String
    ConfigMap instance name.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ConfigMap resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ConfigMap Resource

    Get an existing ConfigMap resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ConfigMapState, opts?: CustomResourceOptions): ConfigMap
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            data: Optional[str] = None,
            description: Optional[str] = None,
            name: Optional[str] = None,
            namespace_id: Optional[str] = None) -> ConfigMap
    func GetConfigMap(ctx *Context, name string, id IDInput, state *ConfigMapState, opts ...ResourceOption) (*ConfigMap, error)
    public static ConfigMap Get(string name, Input<string> id, ConfigMapState? state, CustomResourceOptions? opts = null)
    public static ConfigMap get(String name, Output<String> id, ConfigMapState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Data string
    ConfigMap instance data.
    Description string
    The Description of ConfigMap.
    Name string
    ConfigMap instance name.
    NamespaceId string
    The NamespaceId of ConfigMap.It can contain 2 to 32 lowercase characters.The value is in format {RegionId}:{namespace}
    Data string
    ConfigMap instance data.
    Description string
    The Description of ConfigMap.
    Name string
    ConfigMap instance name.
    NamespaceId string
    The NamespaceId of ConfigMap.It can contain 2 to 32 lowercase characters.The value is in format {RegionId}:{namespace}
    data String
    ConfigMap instance data.
    description String
    The Description of ConfigMap.
    name String
    ConfigMap instance name.
    namespaceId String
    The NamespaceId of ConfigMap.It can contain 2 to 32 lowercase characters.The value is in format {RegionId}:{namespace}
    data string
    ConfigMap instance data.
    description string
    The Description of ConfigMap.
    name string
    ConfigMap instance name.
    namespaceId string
    The NamespaceId of ConfigMap.It can contain 2 to 32 lowercase characters.The value is in format {RegionId}:{namespace}
    data str
    ConfigMap instance data.
    description str
    The Description of ConfigMap.
    name str
    ConfigMap instance name.
    namespace_id str
    The NamespaceId of ConfigMap.It can contain 2 to 32 lowercase characters.The value is in format {RegionId}:{namespace}
    data String
    ConfigMap instance data.
    description String
    The Description of ConfigMap.
    name String
    ConfigMap instance name.
    namespaceId String
    The NamespaceId of ConfigMap.It can contain 2 to 32 lowercase characters.The value is in format {RegionId}:{namespace}

    Import

    Serverless App Engine (SAE) Config Map can be imported using the id, e.g.

    $ pulumi import alicloud:sae/configMap:ConfigMap example <id>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi