Namespace
This resource will help you to manager Container Registry namespaces, see What is Namespace.
NOTE: Available since v1.34.0. NOTE: You need to set your registry password in Container Registry console before use this resource.
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") || "terraform-example";
const _default = new random.index.Integer("default", {
min: 10000000,
max: 99999999,
});
const example = new alicloud.cr.Namespace("example", {
name: `${name}-${_default.result}`,
autoCreate: false,
defaultVisibility: "PUBLIC",
});
Content copied to clipboard
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default = random.index.Integer("default",
min=10000000,
max=99999999)
example = alicloud.cr.Namespace("example",
name=f"{name}-{default['result']}",
auto_create=False,
default_visibility="PUBLIC")
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
var @default = new Random.Index.Integer("default", new()
{
Min = 10000000,
Max = 99999999,
});
var example = new AliCloud.CR.Namespace("example", new()
{
Name = $"{name}-{@default.Result}",
AutoCreate = false,
DefaultVisibility = "PUBLIC",
});
});
Content copied to clipboard
package main
import (
"fmt"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cr"
"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 := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
_default, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
Min: 10000000,
Max: 99999999,
})
if err != nil {
return err
}
_, err = cr.NewNamespace(ctx, "example", &cr.NamespaceArgs{
Name: pulumi.Sprintf("%v-%v", name, _default.Result),
AutoCreate: pulumi.Bool(false),
DefaultVisibility: pulumi.String("PUBLIC"),
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.integer;
import com.pulumi.random.integerArgs;
import com.pulumi.alicloud.cr.Namespace;
import com.pulumi.alicloud.cr.NamespaceArgs;
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("terraform-example");
var default_ = new Integer("default", IntegerArgs.builder()
.min(10000000)
.max(99999999)
.build());
var example = new Namespace("example", NamespaceArgs.builder()
.name(String.format("%s-%s", name,default_.result()))
.autoCreate(false)
.defaultVisibility("PUBLIC")
.build());
}
}
Content copied to clipboard
configuration:
name:
type: string
default: terraform-example
resources:
default:
type: random:integer
properties:
min: 1e+07
max: 9.9999999e+07
example:
type: alicloud:cr:Namespace
properties:
name: ${name}-${default.result}
autoCreate: false
defaultVisibility: PUBLIC
Content copied to clipboard
Import
Container Registry namespace can be imported using the namespace, e.g.
$ pulumi import alicloud:cr/namespace:Namespace default my-namespace
Content copied to clipboard
Properties
Link copied to clipboard
Boolean, when it set to true, repositories are automatically created when pushing new images. If it set to false, you create repository for images before pushing.
Link copied to clipboard
PUBLIC
or PRIVATE
, default repository visibility in this namespace.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard