alicloud.oss.BucketCname
Explore with Pulumi AI
Provides a OSS Bucket Cname resource.
Customizing Bucket domains.
For information about OSS Bucket Cname and how to use it, see What is Bucket Cname.
NOTE: Available since v1.233.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const createBucket = new alicloud.oss.Bucket("CreateBucket", {
    bucket: name,
    storageClass: "Standard",
});
const defaultZaWJfG = new alicloud.oss.BucketCnameToken("defaultZaWJfG", {
    bucket: createBucket.bucket,
    domain: "tftestacc.com",
});
const defaultnHqm5p = new alicloud.dns.AlidnsRecord("defaultnHqm5p", {
    status: "ENABLE",
    line: "default",
    rr: "_dnsauth",
    type: "TXT",
    domainName: "tftestacc.com",
    priority: 1,
    value: defaultZaWJfG.token,
    ttl: 600,
});
const _default = new alicloud.oss.BucketCname("default", {
    bucket: createBucket.bucket,
    domain: defaultnHqm5p.domainName,
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "terraform-example"
create_bucket = alicloud.oss.Bucket("CreateBucket",
    bucket=name,
    storage_class="Standard")
default_za_w_jf_g = alicloud.oss.BucketCnameToken("defaultZaWJfG",
    bucket=create_bucket.bucket,
    domain="tftestacc.com")
defaultn_hqm5p = alicloud.dns.AlidnsRecord("defaultnHqm5p",
    status="ENABLE",
    line="default",
    rr="_dnsauth",
    type="TXT",
    domain_name="tftestacc.com",
    priority=1,
    value=default_za_w_jf_g.token,
    ttl=600)
default = alicloud.oss.BucketCname("default",
    bucket=create_bucket.bucket,
    domain=defaultn_hqm5p.domain_name)
package main
import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/dns"
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/oss"
	"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
		}
		createBucket, err := oss.NewBucket(ctx, "CreateBucket", &oss.BucketArgs{
			Bucket:       pulumi.String(name),
			StorageClass: pulumi.String("Standard"),
		})
		if err != nil {
			return err
		}
		defaultZaWJfG, err := oss.NewBucketCnameToken(ctx, "defaultZaWJfG", &oss.BucketCnameTokenArgs{
			Bucket: createBucket.Bucket,
			Domain: pulumi.String("tftestacc.com"),
		})
		if err != nil {
			return err
		}
		defaultnHqm5p, err := dns.NewAlidnsRecord(ctx, "defaultnHqm5p", &dns.AlidnsRecordArgs{
			Status:     pulumi.String("ENABLE"),
			Line:       pulumi.String("default"),
			Rr:         pulumi.String("_dnsauth"),
			Type:       pulumi.String("TXT"),
			DomainName: pulumi.String("tftestacc.com"),
			Priority:   pulumi.Int(1),
			Value:      defaultZaWJfG.Token,
			Ttl:        pulumi.Int(600),
		})
		if err != nil {
			return err
		}
		_, err = oss.NewBucketCname(ctx, "default", &oss.BucketCnameArgs{
			Bucket: createBucket.Bucket,
			Domain: defaultnHqm5p.DomainName,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var name = config.Get("name") ?? "terraform-example";
    var createBucket = new AliCloud.Oss.Bucket("CreateBucket", new()
    {
        BucketName = name,
        StorageClass = "Standard",
    });
    var defaultZaWJfG = new AliCloud.Oss.BucketCnameToken("defaultZaWJfG", new()
    {
        Bucket = createBucket.BucketName,
        Domain = "tftestacc.com",
    });
    var defaultnHqm5p = new AliCloud.Dns.AlidnsRecord("defaultnHqm5p", new()
    {
        Status = "ENABLE",
        Line = "default",
        Rr = "_dnsauth",
        Type = "TXT",
        DomainName = "tftestacc.com",
        Priority = 1,
        Value = defaultZaWJfG.Token,
        Ttl = 600,
    });
    var @default = new AliCloud.Oss.BucketCname("default", new()
    {
        Bucket = createBucket.BucketName,
        Domain = defaultnHqm5p.DomainName,
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.oss.Bucket;
import com.pulumi.alicloud.oss.BucketArgs;
import com.pulumi.alicloud.oss.BucketCnameToken;
import com.pulumi.alicloud.oss.BucketCnameTokenArgs;
import com.pulumi.alicloud.dns.AlidnsRecord;
import com.pulumi.alicloud.dns.AlidnsRecordArgs;
import com.pulumi.alicloud.oss.BucketCname;
import com.pulumi.alicloud.oss.BucketCnameArgs;
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 createBucket = new Bucket("createBucket", BucketArgs.builder()
            .bucket(name)
            .storageClass("Standard")
            .build());
        var defaultZaWJfG = new BucketCnameToken("defaultZaWJfG", BucketCnameTokenArgs.builder()
            .bucket(createBucket.bucket())
            .domain("tftestacc.com")
            .build());
        var defaultnHqm5p = new AlidnsRecord("defaultnHqm5p", AlidnsRecordArgs.builder()
            .status("ENABLE")
            .line("default")
            .rr("_dnsauth")
            .type("TXT")
            .domainName("tftestacc.com")
            .priority("1")
            .value(defaultZaWJfG.token())
            .ttl("600")
            .build());
        var default_ = new BucketCname("default", BucketCnameArgs.builder()
            .bucket(createBucket.bucket())
            .domain(defaultnHqm5p.domainName())
            .build());
    }
}
configuration:
  name:
    type: string
    default: terraform-example
resources:
  createBucket:
    type: alicloud:oss:Bucket
    name: CreateBucket
    properties:
      bucket: ${name}
      storageClass: Standard
  defaultZaWJfG:
    type: alicloud:oss:BucketCnameToken
    properties:
      bucket: ${createBucket.bucket}
      domain: tftestacc.com
  defaultnHqm5p:
    type: alicloud:dns:AlidnsRecord
    properties:
      status: ENABLE
      line: default
      rr: _dnsauth
      type: TXT
      domainName: tftestacc.com
      priority: '1'
      value: ${defaultZaWJfG.token}
      ttl: '600'
  default:
    type: alicloud:oss:BucketCname
    properties:
      bucket: ${createBucket.bucket}
      domain: ${defaultnHqm5p.domainName}
Create BucketCname Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new BucketCname(name: string, args: BucketCnameArgs, opts?: CustomResourceOptions);@overload
def BucketCname(resource_name: str,
                args: BucketCnameArgs,
                opts: Optional[ResourceOptions] = None)
@overload
def BucketCname(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                bucket: Optional[str] = None,
                domain: Optional[str] = None,
                certificate: Optional[BucketCnameCertificateArgs] = None,
                delete_certificate: Optional[bool] = None,
                force: Optional[bool] = None,
                previous_cert_id: Optional[str] = None)func NewBucketCname(ctx *Context, name string, args BucketCnameArgs, opts ...ResourceOption) (*BucketCname, error)public BucketCname(string name, BucketCnameArgs args, CustomResourceOptions? opts = null)
public BucketCname(String name, BucketCnameArgs args)
public BucketCname(String name, BucketCnameArgs args, CustomResourceOptions options)
type: alicloud:oss:BucketCname
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 BucketCnameArgs
- 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 BucketCnameArgs
- 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 BucketCnameArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args BucketCnameArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args BucketCnameArgs
- 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 bucketCnameResource = new AliCloud.Oss.BucketCname("bucketCnameResource", new()
{
    Bucket = "string",
    Domain = "string",
    Certificate = new AliCloud.Oss.Inputs.BucketCnameCertificateArgs
    {
        CertId = "string",
        Certificate = "string",
        CreationDate = "string",
        Fingerprint = "string",
        PrivateKey = "string",
        Status = "string",
        Type = "string",
        ValidEndDate = "string",
        ValidStartDate = "string",
    },
    DeleteCertificate = false,
    Force = false,
    PreviousCertId = "string",
});
example, err := oss.NewBucketCname(ctx, "bucketCnameResource", &oss.BucketCnameArgs{
	Bucket: pulumi.String("string"),
	Domain: pulumi.String("string"),
	Certificate: &oss.BucketCnameCertificateArgs{
		CertId:         pulumi.String("string"),
		Certificate:    pulumi.String("string"),
		CreationDate:   pulumi.String("string"),
		Fingerprint:    pulumi.String("string"),
		PrivateKey:     pulumi.String("string"),
		Status:         pulumi.String("string"),
		Type:           pulumi.String("string"),
		ValidEndDate:   pulumi.String("string"),
		ValidStartDate: pulumi.String("string"),
	},
	DeleteCertificate: pulumi.Bool(false),
	Force:             pulumi.Bool(false),
	PreviousCertId:    pulumi.String("string"),
})
var bucketCnameResource = new BucketCname("bucketCnameResource", BucketCnameArgs.builder()
    .bucket("string")
    .domain("string")
    .certificate(BucketCnameCertificateArgs.builder()
        .certId("string")
        .certificate("string")
        .creationDate("string")
        .fingerprint("string")
        .privateKey("string")
        .status("string")
        .type("string")
        .validEndDate("string")
        .validStartDate("string")
        .build())
    .deleteCertificate(false)
    .force(false)
    .previousCertId("string")
    .build());
bucket_cname_resource = alicloud.oss.BucketCname("bucketCnameResource",
    bucket="string",
    domain="string",
    certificate={
        "cert_id": "string",
        "certificate": "string",
        "creation_date": "string",
        "fingerprint": "string",
        "private_key": "string",
        "status": "string",
        "type": "string",
        "valid_end_date": "string",
        "valid_start_date": "string",
    },
    delete_certificate=False,
    force=False,
    previous_cert_id="string")
const bucketCnameResource = new alicloud.oss.BucketCname("bucketCnameResource", {
    bucket: "string",
    domain: "string",
    certificate: {
        certId: "string",
        certificate: "string",
        creationDate: "string",
        fingerprint: "string",
        privateKey: "string",
        status: "string",
        type: "string",
        validEndDate: "string",
        validStartDate: "string",
    },
    deleteCertificate: false,
    force: false,
    previousCertId: "string",
});
type: alicloud:oss:BucketCname
properties:
    bucket: string
    certificate:
        certId: string
        certificate: string
        creationDate: string
        fingerprint: string
        privateKey: string
        status: string
        type: string
        validEndDate: string
        validStartDate: string
    deleteCertificate: false
    domain: string
    force: false
    previousCertId: string
BucketCname Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The BucketCname resource accepts the following input properties:
- Bucket string
- The bucket to which the custom domain name belongs
- Domain string
- User-defined domain name
- Certificate
Pulumi.Ali Cloud. Oss. Inputs. Bucket Cname Certificate 
- The container for the certificate configuration. See certificatebelow.
- DeleteCertificate bool
- Whether to delete the certificate.
- Force bool
- Whether to force overwrite certificate.
- PreviousCert stringId 
- The current certificate ID. If the Force value is not true, the OSS Server checks whether the value matches the current certificate ID. If the value does not match, an error is reported.
- Bucket string
- The bucket to which the custom domain name belongs
- Domain string
- User-defined domain name
- Certificate
BucketCname Certificate Args 
- The container for the certificate configuration. See certificatebelow.
- DeleteCertificate bool
- Whether to delete the certificate.
- Force bool
- Whether to force overwrite certificate.
- PreviousCert stringId 
- The current certificate ID. If the Force value is not true, the OSS Server checks whether the value matches the current certificate ID. If the value does not match, an error is reported.
- bucket String
- The bucket to which the custom domain name belongs
- domain String
- User-defined domain name
- certificate
BucketCname Certificate 
- The container for the certificate configuration. See certificatebelow.
- deleteCertificate Boolean
- Whether to delete the certificate.
- force Boolean
- Whether to force overwrite certificate.
- previousCert StringId 
- The current certificate ID. If the Force value is not true, the OSS Server checks whether the value matches the current certificate ID. If the value does not match, an error is reported.
- bucket string
- The bucket to which the custom domain name belongs
- domain string
- User-defined domain name
- certificate
BucketCname Certificate 
- The container for the certificate configuration. See certificatebelow.
- deleteCertificate boolean
- Whether to delete the certificate.
- force boolean
- Whether to force overwrite certificate.
- previousCert stringId 
- The current certificate ID. If the Force value is not true, the OSS Server checks whether the value matches the current certificate ID. If the value does not match, an error is reported.
- bucket str
- The bucket to which the custom domain name belongs
- domain str
- User-defined domain name
- certificate
BucketCname Certificate Args 
- The container for the certificate configuration. See certificatebelow.
- delete_certificate bool
- Whether to delete the certificate.
- force bool
- Whether to force overwrite certificate.
- previous_cert_ strid 
- The current certificate ID. If the Force value is not true, the OSS Server checks whether the value matches the current certificate ID. If the value does not match, an error is reported.
- bucket String
- The bucket to which the custom domain name belongs
- domain String
- User-defined domain name
- certificate Property Map
- The container for the certificate configuration. See certificatebelow.
- deleteCertificate Boolean
- Whether to delete the certificate.
- force Boolean
- Whether to force overwrite certificate.
- previousCert StringId 
- The current certificate ID. If the Force value is not true, the OSS Server checks whether the value matches the current certificate ID. If the value does not match, an error is reported.
Outputs
All input properties are implicitly available as output properties. Additionally, the BucketCname resource produces the following output properties:
Look up Existing BucketCname Resource
Get an existing BucketCname 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?: BucketCnameState, opts?: CustomResourceOptions): BucketCname@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        bucket: Optional[str] = None,
        certificate: Optional[BucketCnameCertificateArgs] = None,
        delete_certificate: Optional[bool] = None,
        domain: Optional[str] = None,
        force: Optional[bool] = None,
        previous_cert_id: Optional[str] = None,
        status: Optional[str] = None) -> BucketCnamefunc GetBucketCname(ctx *Context, name string, id IDInput, state *BucketCnameState, opts ...ResourceOption) (*BucketCname, error)public static BucketCname Get(string name, Input<string> id, BucketCnameState? state, CustomResourceOptions? opts = null)public static BucketCname get(String name, Output<String> id, BucketCnameState state, CustomResourceOptions options)resources:  _:    type: alicloud:oss:BucketCname    get:      id: ${id}- 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.
- Bucket string
- The bucket to which the custom domain name belongs
- Certificate
Pulumi.Ali Cloud. Oss. Inputs. Bucket Cname Certificate 
- The container for the certificate configuration. See certificatebelow.
- DeleteCertificate bool
- Whether to delete the certificate.
- Domain string
- User-defined domain name
- Force bool
- Whether to force overwrite certificate.
- PreviousCert stringId 
- The current certificate ID. If the Force value is not true, the OSS Server checks whether the value matches the current certificate ID. If the value does not match, an error is reported.
- Status string
- Cname status
- Bucket string
- The bucket to which the custom domain name belongs
- Certificate
BucketCname Certificate Args 
- The container for the certificate configuration. See certificatebelow.
- DeleteCertificate bool
- Whether to delete the certificate.
- Domain string
- User-defined domain name
- Force bool
- Whether to force overwrite certificate.
- PreviousCert stringId 
- The current certificate ID. If the Force value is not true, the OSS Server checks whether the value matches the current certificate ID. If the value does not match, an error is reported.
- Status string
- Cname status
- bucket String
- The bucket to which the custom domain name belongs
- certificate
BucketCname Certificate 
- The container for the certificate configuration. See certificatebelow.
- deleteCertificate Boolean
- Whether to delete the certificate.
- domain String
- User-defined domain name
- force Boolean
- Whether to force overwrite certificate.
- previousCert StringId 
- The current certificate ID. If the Force value is not true, the OSS Server checks whether the value matches the current certificate ID. If the value does not match, an error is reported.
- status String
- Cname status
- bucket string
- The bucket to which the custom domain name belongs
- certificate
BucketCname Certificate 
- The container for the certificate configuration. See certificatebelow.
- deleteCertificate boolean
- Whether to delete the certificate.
- domain string
- User-defined domain name
- force boolean
- Whether to force overwrite certificate.
- previousCert stringId 
- The current certificate ID. If the Force value is not true, the OSS Server checks whether the value matches the current certificate ID. If the value does not match, an error is reported.
- status string
- Cname status
- bucket str
- The bucket to which the custom domain name belongs
- certificate
BucketCname Certificate Args 
- The container for the certificate configuration. See certificatebelow.
- delete_certificate bool
- Whether to delete the certificate.
- domain str
- User-defined domain name
- force bool
- Whether to force overwrite certificate.
- previous_cert_ strid 
- The current certificate ID. If the Force value is not true, the OSS Server checks whether the value matches the current certificate ID. If the value does not match, an error is reported.
- status str
- Cname status
- bucket String
- The bucket to which the custom domain name belongs
- certificate Property Map
- The container for the certificate configuration. See certificatebelow.
- deleteCertificate Boolean
- Whether to delete the certificate.
- domain String
- User-defined domain name
- force Boolean
- Whether to force overwrite certificate.
- previousCert StringId 
- The current certificate ID. If the Force value is not true, the OSS Server checks whether the value matches the current certificate ID. If the value does not match, an error is reported.
- status String
- Cname status
Supporting Types
BucketCnameCertificate, BucketCnameCertificateArgs      
- CertId string
- Certificate Identifier
- Certificate string
- The certificate public key.
- CreationDate string
- Certificate creation time
- Fingerprint string
- Certificate Fingerprint
- PrivateKey string
- The certificate private key.
- Status string
- Cname status
- Type string
- Certificate Type
- ValidEnd stringDate 
- Certificate validity period end time
- ValidStart stringDate 
- Certificate validity period start time
- CertId string
- Certificate Identifier
- Certificate string
- The certificate public key.
- CreationDate string
- Certificate creation time
- Fingerprint string
- Certificate Fingerprint
- PrivateKey string
- The certificate private key.
- Status string
- Cname status
- Type string
- Certificate Type
- ValidEnd stringDate 
- Certificate validity period end time
- ValidStart stringDate 
- Certificate validity period start time
- certId String
- Certificate Identifier
- certificate String
- The certificate public key.
- creationDate String
- Certificate creation time
- fingerprint String
- Certificate Fingerprint
- privateKey String
- The certificate private key.
- status String
- Cname status
- type String
- Certificate Type
- validEnd StringDate 
- Certificate validity period end time
- validStart StringDate 
- Certificate validity period start time
- certId string
- Certificate Identifier
- certificate string
- The certificate public key.
- creationDate string
- Certificate creation time
- fingerprint string
- Certificate Fingerprint
- privateKey string
- The certificate private key.
- status string
- Cname status
- type string
- Certificate Type
- validEnd stringDate 
- Certificate validity period end time
- validStart stringDate 
- Certificate validity period start time
- cert_id str
- Certificate Identifier
- certificate str
- The certificate public key.
- creation_date str
- Certificate creation time
- fingerprint str
- Certificate Fingerprint
- private_key str
- The certificate private key.
- status str
- Cname status
- type str
- Certificate Type
- valid_end_ strdate 
- Certificate validity period end time
- valid_start_ strdate 
- Certificate validity period start time
- certId String
- Certificate Identifier
- certificate String
- The certificate public key.
- creationDate String
- Certificate creation time
- fingerprint String
- Certificate Fingerprint
- privateKey String
- The certificate private key.
- status String
- Cname status
- type String
- Certificate Type
- validEnd StringDate 
- Certificate validity period end time
- validStart StringDate 
- Certificate validity period start time
Import
OSS Bucket Cname can be imported using the id, e.g.
$ pulumi import alicloud:oss/bucketCname:BucketCname example <bucket>:<domain>
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 alicloudTerraform Provider.