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
certificate
below. - Delete
Certificate bool - Whether to delete the certificate.
- Force bool
- Whether to force overwrite certificate.
- Previous
Cert 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
Bucket
Cname Certificate Args - The container for the certificate configuration. See
certificate
below. - Delete
Certificate bool - Whether to delete the certificate.
- Force bool
- Whether to force overwrite certificate.
- Previous
Cert 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
Bucket
Cname Certificate - The container for the certificate configuration. See
certificate
below. - delete
Certificate Boolean - Whether to delete the certificate.
- force Boolean
- Whether to force overwrite certificate.
- previous
Cert 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
Bucket
Cname Certificate - The container for the certificate configuration. See
certificate
below. - delete
Certificate boolean - Whether to delete the certificate.
- force boolean
- Whether to force overwrite certificate.
- previous
Cert 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
Bucket
Cname Certificate Args - The container for the certificate configuration. See
certificate
below. - 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
certificate
below. - delete
Certificate Boolean - Whether to delete the certificate.
- force Boolean
- Whether to force overwrite certificate.
- previous
Cert 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) -> BucketCname
func 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)
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.
- 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
certificate
below. - Delete
Certificate bool - Whether to delete the certificate.
- Domain string
- User-defined domain name
- Force bool
- Whether to force overwrite certificate.
- Previous
Cert 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
Bucket
Cname Certificate Args - The container for the certificate configuration. See
certificate
below. - Delete
Certificate bool - Whether to delete the certificate.
- Domain string
- User-defined domain name
- Force bool
- Whether to force overwrite certificate.
- Previous
Cert 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
Bucket
Cname Certificate - The container for the certificate configuration. See
certificate
below. - delete
Certificate Boolean - Whether to delete the certificate.
- domain String
- User-defined domain name
- force Boolean
- Whether to force overwrite certificate.
- previous
Cert 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
Bucket
Cname Certificate - The container for the certificate configuration. See
certificate
below. - delete
Certificate boolean - Whether to delete the certificate.
- domain string
- User-defined domain name
- force boolean
- Whether to force overwrite certificate.
- previous
Cert 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
Bucket
Cname Certificate Args - The container for the certificate configuration. See
certificate
below. - 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
certificate
below. - delete
Certificate Boolean - Whether to delete the certificate.
- domain String
- User-defined domain name
- force Boolean
- Whether to force overwrite certificate.
- previous
Cert 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
- Cert
Id string - Certificate Identifier
- Certificate string
- The certificate public key.
- Creation
Date string - Certificate creation time
- Fingerprint string
- Certificate Fingerprint
- Private
Key string - The certificate private key.
- Status string
- Cname status
- Type string
- Certificate Type
- Valid
End stringDate - Certificate validity period end time
- Valid
Start stringDate - Certificate validity period start time
- Cert
Id string - Certificate Identifier
- Certificate string
- The certificate public key.
- Creation
Date string - Certificate creation time
- Fingerprint string
- Certificate Fingerprint
- Private
Key string - The certificate private key.
- Status string
- Cname status
- Type string
- Certificate Type
- Valid
End stringDate - Certificate validity period end time
- Valid
Start stringDate - Certificate validity period start time
- cert
Id String - Certificate Identifier
- certificate String
- The certificate public key.
- creation
Date String - Certificate creation time
- fingerprint String
- Certificate Fingerprint
- private
Key String - The certificate private key.
- status String
- Cname status
- type String
- Certificate Type
- valid
End StringDate - Certificate validity period end time
- valid
Start StringDate - Certificate validity period start time
- cert
Id string - Certificate Identifier
- certificate string
- The certificate public key.
- creation
Date string - Certificate creation time
- fingerprint string
- Certificate Fingerprint
- private
Key string - The certificate private key.
- status string
- Cname status
- type string
- Certificate Type
- valid
End stringDate - Certificate validity period end time
- valid
Start 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
- cert
Id String - Certificate Identifier
- certificate String
- The certificate public key.
- creation
Date String - Certificate creation time
- fingerprint String
- Certificate Fingerprint
- private
Key String - The certificate private key.
- status String
- Cname status
- type String
- Certificate Type
- valid
End StringDate - Certificate validity period end time
- valid
Start 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
alicloud
Terraform Provider.