Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi
alicloud.sae.getConfigMaps
Explore with Pulumi AI
This data source provides the Sae Config Maps of the current Alibaba Cloud user.
NOTE: Available in v1.130.0+.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const configMapName = config.get("configMapName") || "examplename";
const example = new alicloud.sae.Namespace("example", {
namespaceId: "cn-hangzhou:yourname",
namespaceName: "example_value",
namespaceDescription: "your_description",
});
const exampleConfigMap = new alicloud.sae.ConfigMap("example", {
data: JSON.stringify({
"env.home": "/root",
"env.shell": "/bin/sh",
}),
name: configMapName,
namespaceId: example.namespaceId,
});
const nameRegex = alicloud.sae.getConfigMapsOutput({
namespaceId: example.namespaceId,
nameRegex: "^example",
});
export const saeConfigMapId = nameRegex.apply(nameRegex => nameRegex.maps?.[0]?.id);
import pulumi
import json
import pulumi_alicloud as alicloud
config = pulumi.Config()
config_map_name = config.get("configMapName")
if config_map_name is None:
config_map_name = "examplename"
example = alicloud.sae.Namespace("example",
namespace_id="cn-hangzhou:yourname",
namespace_name="example_value",
namespace_description="your_description")
example_config_map = alicloud.sae.ConfigMap("example",
data=json.dumps({
"env.home": "/root",
"env.shell": "/bin/sh",
}),
name=config_map_name,
namespace_id=example.namespace_id)
name_regex = alicloud.sae.get_config_maps_output(namespace_id=example.namespace_id,
name_regex="^example")
pulumi.export("saeConfigMapId", name_regex.maps[0].id)
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/sae"
"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, "")
configMapName := "examplename"
if param := cfg.Get("configMapName"); param != "" {
configMapName = param
}
example, err := sae.NewNamespace(ctx, "example", &sae.NamespaceArgs{
NamespaceId: pulumi.String("cn-hangzhou:yourname"),
NamespaceName: pulumi.String("example_value"),
NamespaceDescription: pulumi.String("your_description"),
})
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, "example", &sae.ConfigMapArgs{
Data: pulumi.String(json0),
Name: pulumi.String(configMapName),
NamespaceId: example.NamespaceId,
})
if err != nil {
return err
}
nameRegex := sae.GetConfigMapsOutput(ctx, sae.GetConfigMapsOutputArgs{
NamespaceId: example.NamespaceId,
NameRegex: pulumi.String("^example"),
}, nil)
ctx.Export("saeConfigMapId", nameRegex.ApplyT(func(nameRegex sae.GetConfigMapsResult) (*string, error) {
return &nameRegex.Maps[0].Id, nil
}).(pulumi.StringPtrOutput))
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var configMapName = config.Get("configMapName") ?? "examplename";
var example = new AliCloud.Sae.Namespace("example", new()
{
NamespaceId = "cn-hangzhou:yourname",
NamespaceName = "example_value",
NamespaceDescription = "your_description",
});
var exampleConfigMap = new AliCloud.Sae.ConfigMap("example", new()
{
Data = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["env.home"] = "/root",
["env.shell"] = "/bin/sh",
}),
Name = configMapName,
NamespaceId = example.NamespaceId,
});
var nameRegex = AliCloud.Sae.GetConfigMaps.Invoke(new()
{
NamespaceId = example.NamespaceId,
NameRegex = "^example",
});
return new Dictionary<string, object?>
{
["saeConfigMapId"] = nameRegex.Apply(getConfigMapsResult => getConfigMapsResult.Maps[0]?.Id),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
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 com.pulumi.alicloud.sae.SaeFunctions;
import com.pulumi.alicloud.sae.inputs.GetConfigMapsArgs;
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 configMapName = config.get("configMapName").orElse("examplename");
var example = new Namespace("example", NamespaceArgs.builder()
.namespaceId("cn-hangzhou:yourname")
.namespaceName("example_value")
.namespaceDescription("your_description")
.build());
var exampleConfigMap = new ConfigMap("exampleConfigMap", ConfigMapArgs.builder()
.data(serializeJson(
jsonObject(
jsonProperty("env.home", "/root"),
jsonProperty("env.shell", "/bin/sh")
)))
.name(configMapName)
.namespaceId(example.namespaceId())
.build());
final var nameRegex = SaeFunctions.getConfigMaps(GetConfigMapsArgs.builder()
.namespaceId(example.namespaceId())
.nameRegex("^example")
.build());
ctx.export("saeConfigMapId", nameRegex.applyValue(getConfigMapsResult -> getConfigMapsResult).applyValue(nameRegex -> nameRegex.applyValue(getConfigMapsResult -> getConfigMapsResult.maps()[0].id())));
}
}
configuration:
configMapName:
type: string
default: examplename
resources:
example:
type: alicloud:sae:Namespace
properties:
namespaceId: cn-hangzhou:yourname
namespaceName: example_value
namespaceDescription: your_description
exampleConfigMap:
type: alicloud:sae:ConfigMap
name: example
properties:
data:
fn::toJSON:
env.home: /root
env.shell: /bin/sh
name: ${configMapName}
namespaceId: ${example.namespaceId}
variables:
nameRegex:
fn::invoke:
Function: alicloud:sae:getConfigMaps
Arguments:
namespaceId: ${example.namespaceId}
nameRegex: ^example
outputs:
saeConfigMapId: ${nameRegex.maps[0].id}
Using getConfigMaps
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 getConfigMaps(args: GetConfigMapsArgs, opts?: InvokeOptions): Promise<GetConfigMapsResult>
function getConfigMapsOutput(args: GetConfigMapsOutputArgs, opts?: InvokeOptions): Output<GetConfigMapsResult>
def get_config_maps(ids: Optional[Sequence[str]] = None,
name_regex: Optional[str] = None,
namespace_id: Optional[str] = None,
output_file: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetConfigMapsResult
def get_config_maps_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
name_regex: Optional[pulumi.Input[str]] = None,
namespace_id: Optional[pulumi.Input[str]] = None,
output_file: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetConfigMapsResult]
func GetConfigMaps(ctx *Context, args *GetConfigMapsArgs, opts ...InvokeOption) (*GetConfigMapsResult, error)
func GetConfigMapsOutput(ctx *Context, args *GetConfigMapsOutputArgs, opts ...InvokeOption) GetConfigMapsResultOutput
> Note: This function is named GetConfigMaps
in the Go SDK.
public static class GetConfigMaps
{
public static Task<GetConfigMapsResult> InvokeAsync(GetConfigMapsArgs args, InvokeOptions? opts = null)
public static Output<GetConfigMapsResult> Invoke(GetConfigMapsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetConfigMapsResult> getConfigMaps(GetConfigMapsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: alicloud:sae/getConfigMaps:getConfigMaps
arguments:
# arguments dictionary
The following arguments are supported:
- Namespace
Id string - The NamespaceId of Config Maps. The Id of Namespace.It can contain 2 to 32 characters.The value is in format {RegionId}:{namespace}.
- Ids List<string>
- A list of Config Map IDs.
- Name
Regex string - A regex string to filter results by Config Map name.
- Output
File string - File name where to save data source results (after running
pulumi preview
).
- Namespace
Id string - The NamespaceId of Config Maps. The Id of Namespace.It can contain 2 to 32 characters.The value is in format {RegionId}:{namespace}.
- Ids []string
- A list of Config Map IDs.
- Name
Regex string - A regex string to filter results by Config Map name.
- Output
File string - File name where to save data source results (after running
pulumi preview
).
- namespace
Id String - The NamespaceId of Config Maps. The Id of Namespace.It can contain 2 to 32 characters.The value is in format {RegionId}:{namespace}.
- ids List<String>
- A list of Config Map IDs.
- name
Regex String - A regex string to filter results by Config Map name.
- output
File String - File name where to save data source results (after running
pulumi preview
).
- namespace
Id string - The NamespaceId of Config Maps. The Id of Namespace.It can contain 2 to 32 characters.The value is in format {RegionId}:{namespace}.
- ids string[]
- A list of Config Map IDs.
- name
Regex string - A regex string to filter results by Config Map name.
- output
File string - File name where to save data source results (after running
pulumi preview
).
- namespace_
id str - The NamespaceId of Config Maps. The Id of Namespace.It can contain 2 to 32 characters.The value is in format {RegionId}:{namespace}.
- ids Sequence[str]
- A list of Config Map IDs.
- name_
regex str - A regex string to filter results by Config Map name.
- output_
file str - File name where to save data source results (after running
pulumi preview
).
- namespace
Id String - The NamespaceId of Config Maps. The Id of Namespace.It can contain 2 to 32 characters.The value is in format {RegionId}:{namespace}.
- ids List<String>
- A list of Config Map IDs.
- name
Regex String - A regex string to filter results by Config Map name.
- output
File String - File name where to save data source results (after running
pulumi preview
).
getConfigMaps Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- Maps
List<Pulumi.
Ali Cloud. Sae. Outputs. Get Config Maps Map> - Names List<string>
- Namespace
Id string - Name
Regex string - Output
File string
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- Maps
[]Get
Config Maps Map - Names []string
- Namespace
Id string - Name
Regex string - Output
File string
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- maps
List<Get
Config Maps Map> - names List<String>
- namespace
Id String - name
Regex String - output
File String
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- maps
Get
Config Maps Map[] - names string[]
- namespace
Id string - name
Regex string - output
File string
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- maps
Sequence[Get
Config Maps Map] - names Sequence[str]
- namespace_
id str - name_
regex str - output_
file str
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- maps List<Property Map>
- names List<String>
- namespace
Id String - name
Regex String - output
File String
Supporting Types
GetConfigMapsMap
- Config
Map stringId - The first ID of the resource.
- Create
Time string - The Creation Time of the ConfigMap.
- Data string
- ConfigMap instance data. The value's format is a
json
string - Description string
- The Description of Config Map.
- Id string
- The ID of the Config Map.
- Name string
- ConfigMap instance name.
- Namespace
Id string - The NamespaceId of Config Maps.
- Config
Map stringId - The first ID of the resource.
- Create
Time string - The Creation Time of the ConfigMap.
- Data string
- ConfigMap instance data. The value's format is a
json
string - Description string
- The Description of Config Map.
- Id string
- The ID of the Config Map.
- Name string
- ConfigMap instance name.
- Namespace
Id string - The NamespaceId of Config Maps.
- config
Map StringId - The first ID of the resource.
- create
Time String - The Creation Time of the ConfigMap.
- data String
- ConfigMap instance data. The value's format is a
json
string - description String
- The Description of Config Map.
- id String
- The ID of the Config Map.
- name String
- ConfigMap instance name.
- namespace
Id String - The NamespaceId of Config Maps.
- config
Map stringId - The first ID of the resource.
- create
Time string - The Creation Time of the ConfigMap.
- data string
- ConfigMap instance data. The value's format is a
json
string - description string
- The Description of Config Map.
- id string
- The ID of the Config Map.
- name string
- ConfigMap instance name.
- namespace
Id string - The NamespaceId of Config Maps.
- config_
map_ strid - The first ID of the resource.
- create_
time str - The Creation Time of the ConfigMap.
- data str
- ConfigMap instance data. The value's format is a
json
string - description str
- The Description of Config Map.
- id str
- The ID of the Config Map.
- name str
- ConfigMap instance name.
- namespace_
id str - The NamespaceId of Config Maps.
- config
Map StringId - The first ID of the resource.
- create
Time String - The Creation Time of the ConfigMap.
- data String
- ConfigMap instance data. The value's format is a
json
string - description String
- The Description of Config Map.
- id String
- The ID of the Config Map.
- name String
- ConfigMap instance name.
- namespace
Id String - The NamespaceId of Config Maps.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.