1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. CosBucketDomainCertificateAttachment
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

tencentcloud.CosBucketDomainCertificateAttachment

Explore with Pulumi AI

tencentcloud logo
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

    Provides a resource to attach/detach the corresponding certificate for the domain name in specified cos bucket.

    NOTE: The current resource does not support cdc.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const info = tencentcloud.getUserInfo({});
    const appId = info.then(info => info.appId);
    const exampleCosBucket = new tencentcloud.CosBucket("exampleCosBucket", {
        bucket: appId.then(appId => `private-bucket-${appId}`),
        acl: "private",
        forceClean: true,
    });
    const exampleCosBucketDomainCertificateAttachment = new tencentcloud.CosBucketDomainCertificateAttachment("exampleCosBucketDomainCertificateAttachment", {
        bucket: exampleCosBucket.cosBucketId,
        domainCertificate: {
            domain: "www.example.com",
            certificate: {
                certType: "CustomCert",
                customCert: {
                    certId: "Mbx45wts",
                    cert: "-----BEGIN CERTIFICATE-----",
                    privateKey: "-----BEGIN RSA PRIVATE_KEY-----",
                },
            },
        },
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    info = tencentcloud.get_user_info()
    app_id = info.app_id
    example_cos_bucket = tencentcloud.CosBucket("exampleCosBucket",
        bucket=f"private-bucket-{app_id}",
        acl="private",
        force_clean=True)
    example_cos_bucket_domain_certificate_attachment = tencentcloud.CosBucketDomainCertificateAttachment("exampleCosBucketDomainCertificateAttachment",
        bucket=example_cos_bucket.cos_bucket_id,
        domain_certificate={
            "domain": "www.example.com",
            "certificate": {
                "cert_type": "CustomCert",
                "custom_cert": {
                    "cert_id": "Mbx45wts",
                    "cert": "-----BEGIN CERTIFICATE-----",
                    "private_key": "-----BEGIN RSA PRIVATE_KEY-----",
                },
            },
        })
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		info, err := tencentcloud.GetUserInfo(ctx, &tencentcloud.GetUserInfoArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		appId := info.AppId
    		exampleCosBucket, err := tencentcloud.NewCosBucket(ctx, "exampleCosBucket", &tencentcloud.CosBucketArgs{
    			Bucket:     pulumi.Sprintf("private-bucket-%v", appId),
    			Acl:        pulumi.String("private"),
    			ForceClean: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = tencentcloud.NewCosBucketDomainCertificateAttachment(ctx, "exampleCosBucketDomainCertificateAttachment", &tencentcloud.CosBucketDomainCertificateAttachmentArgs{
    			Bucket: exampleCosBucket.CosBucketId,
    			DomainCertificate: &tencentcloud.CosBucketDomainCertificateAttachmentDomainCertificateArgs{
    				Domain: pulumi.String("www.example.com"),
    				Certificate: &tencentcloud.CosBucketDomainCertificateAttachmentDomainCertificateCertificateArgs{
    					CertType: pulumi.String("CustomCert"),
    					CustomCert: &tencentcloud.CosBucketDomainCertificateAttachmentDomainCertificateCertificateCustomCertArgs{
    						CertId:     pulumi.String("Mbx45wts"),
    						Cert:       pulumi.String("-----BEGIN CERTIFICATE-----"),
    						PrivateKey: pulumi.String("-----BEGIN RSA PRIVATE_KEY-----"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var info = Tencentcloud.GetUserInfo.Invoke();
    
        var appId = info.Apply(getUserInfoResult => getUserInfoResult.AppId);
    
        var exampleCosBucket = new Tencentcloud.CosBucket("exampleCosBucket", new()
        {
            Bucket = appId.Apply(appId => $"private-bucket-{appId}"),
            Acl = "private",
            ForceClean = true,
        });
    
        var exampleCosBucketDomainCertificateAttachment = new Tencentcloud.CosBucketDomainCertificateAttachment("exampleCosBucketDomainCertificateAttachment", new()
        {
            Bucket = exampleCosBucket.CosBucketId,
            DomainCertificate = new Tencentcloud.Inputs.CosBucketDomainCertificateAttachmentDomainCertificateArgs
            {
                Domain = "www.example.com",
                Certificate = new Tencentcloud.Inputs.CosBucketDomainCertificateAttachmentDomainCertificateCertificateArgs
                {
                    CertType = "CustomCert",
                    CustomCert = new Tencentcloud.Inputs.CosBucketDomainCertificateAttachmentDomainCertificateCertificateCustomCertArgs
                    {
                        CertId = "Mbx45wts",
                        Cert = "-----BEGIN CERTIFICATE-----",
                        PrivateKey = "-----BEGIN RSA PRIVATE_KEY-----",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.TencentcloudFunctions;
    import com.pulumi.tencentcloud.inputs.GetUserInfoArgs;
    import com.pulumi.tencentcloud.CosBucket;
    import com.pulumi.tencentcloud.CosBucketArgs;
    import com.pulumi.tencentcloud.CosBucketDomainCertificateAttachment;
    import com.pulumi.tencentcloud.CosBucketDomainCertificateAttachmentArgs;
    import com.pulumi.tencentcloud.inputs.CosBucketDomainCertificateAttachmentDomainCertificateArgs;
    import com.pulumi.tencentcloud.inputs.CosBucketDomainCertificateAttachmentDomainCertificateCertificateArgs;
    import com.pulumi.tencentcloud.inputs.CosBucketDomainCertificateAttachmentDomainCertificateCertificateCustomCertArgs;
    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 info = TencentcloudFunctions.getUserInfo();
    
            final var appId = info.applyValue(getUserInfoResult -> getUserInfoResult.appId());
    
            var exampleCosBucket = new CosBucket("exampleCosBucket", CosBucketArgs.builder()
                .bucket(String.format("private-bucket-%s", appId))
                .acl("private")
                .forceClean(true)
                .build());
    
            var exampleCosBucketDomainCertificateAttachment = new CosBucketDomainCertificateAttachment("exampleCosBucketDomainCertificateAttachment", CosBucketDomainCertificateAttachmentArgs.builder()
                .bucket(exampleCosBucket.cosBucketId())
                .domainCertificate(CosBucketDomainCertificateAttachmentDomainCertificateArgs.builder()
                    .domain("www.example.com")
                    .certificate(CosBucketDomainCertificateAttachmentDomainCertificateCertificateArgs.builder()
                        .certType("CustomCert")
                        .customCert(CosBucketDomainCertificateAttachmentDomainCertificateCertificateCustomCertArgs.builder()
                            .certId("Mbx45wts")
                            .cert("-----BEGIN CERTIFICATE-----")
                            .privateKey("-----BEGIN RSA PRIVATE_KEY-----")
                            .build())
                        .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      exampleCosBucket:
        type: tencentcloud:CosBucket
        properties:
          bucket: private-bucket-${appId}
          acl: private
          forceClean: true
      exampleCosBucketDomainCertificateAttachment:
        type: tencentcloud:CosBucketDomainCertificateAttachment
        properties:
          bucket: ${exampleCosBucket.cosBucketId}
          domainCertificate:
            domain: www.example.com
            certificate:
              certType: CustomCert
              customCert:
                certId: Mbx45wts
                cert: '-----BEGIN CERTIFICATE-----'
                privateKey: '-----BEGIN RSA PRIVATE_KEY-----'
    variables:
      info:
        fn::invoke:
          function: tencentcloud:getUserInfo
          arguments: {}
      appId: ${info.appId}
    

    Create CosBucketDomainCertificateAttachment Resource

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

    Constructor syntax

    new CosBucketDomainCertificateAttachment(name: string, args: CosBucketDomainCertificateAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def CosBucketDomainCertificateAttachment(resource_name: str,
                                             args: CosBucketDomainCertificateAttachmentArgs,
                                             opts: Optional[ResourceOptions] = None)
    
    @overload
    def CosBucketDomainCertificateAttachment(resource_name: str,
                                             opts: Optional[ResourceOptions] = None,
                                             bucket: Optional[str] = None,
                                             domain_certificate: Optional[CosBucketDomainCertificateAttachmentDomainCertificateArgs] = None,
                                             cos_bucket_domain_certificate_attachment_id: Optional[str] = None)
    func NewCosBucketDomainCertificateAttachment(ctx *Context, name string, args CosBucketDomainCertificateAttachmentArgs, opts ...ResourceOption) (*CosBucketDomainCertificateAttachment, error)
    public CosBucketDomainCertificateAttachment(string name, CosBucketDomainCertificateAttachmentArgs args, CustomResourceOptions? opts = null)
    public CosBucketDomainCertificateAttachment(String name, CosBucketDomainCertificateAttachmentArgs args)
    public CosBucketDomainCertificateAttachment(String name, CosBucketDomainCertificateAttachmentArgs args, CustomResourceOptions options)
    
    type: tencentcloud:CosBucketDomainCertificateAttachment
    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 CosBucketDomainCertificateAttachmentArgs
    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 CosBucketDomainCertificateAttachmentArgs
    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 CosBucketDomainCertificateAttachmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CosBucketDomainCertificateAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CosBucketDomainCertificateAttachmentArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    CosBucketDomainCertificateAttachment 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 CosBucketDomainCertificateAttachment resource accepts the following input properties:

    Bucket string
    Bucket name.
    DomainCertificate CosBucketDomainCertificateAttachmentDomainCertificate
    The certificate of specified doamin.
    CosBucketDomainCertificateAttachmentId string
    ID of the resource.
    Bucket string
    Bucket name.
    DomainCertificate CosBucketDomainCertificateAttachmentDomainCertificateArgs
    The certificate of specified doamin.
    CosBucketDomainCertificateAttachmentId string
    ID of the resource.
    bucket String
    Bucket name.
    domainCertificate CosBucketDomainCertificateAttachmentDomainCertificate
    The certificate of specified doamin.
    cosBucketDomainCertificateAttachmentId String
    ID of the resource.
    bucket string
    Bucket name.
    domainCertificate CosBucketDomainCertificateAttachmentDomainCertificate
    The certificate of specified doamin.
    cosBucketDomainCertificateAttachmentId string
    ID of the resource.
    bucket String
    Bucket name.
    domainCertificate Property Map
    The certificate of specified doamin.
    cosBucketDomainCertificateAttachmentId String
    ID of the resource.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the CosBucketDomainCertificateAttachment 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 CosBucketDomainCertificateAttachment Resource

    Get an existing CosBucketDomainCertificateAttachment 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?: CosBucketDomainCertificateAttachmentState, opts?: CustomResourceOptions): CosBucketDomainCertificateAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            bucket: Optional[str] = None,
            cos_bucket_domain_certificate_attachment_id: Optional[str] = None,
            domain_certificate: Optional[CosBucketDomainCertificateAttachmentDomainCertificateArgs] = None) -> CosBucketDomainCertificateAttachment
    func GetCosBucketDomainCertificateAttachment(ctx *Context, name string, id IDInput, state *CosBucketDomainCertificateAttachmentState, opts ...ResourceOption) (*CosBucketDomainCertificateAttachment, error)
    public static CosBucketDomainCertificateAttachment Get(string name, Input<string> id, CosBucketDomainCertificateAttachmentState? state, CustomResourceOptions? opts = null)
    public static CosBucketDomainCertificateAttachment get(String name, Output<String> id, CosBucketDomainCertificateAttachmentState state, CustomResourceOptions options)
    resources:  _:    type: tencentcloud:CosBucketDomainCertificateAttachment    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.
    The following state arguments are supported:
    Bucket string
    Bucket name.
    CosBucketDomainCertificateAttachmentId string
    ID of the resource.
    DomainCertificate CosBucketDomainCertificateAttachmentDomainCertificate
    The certificate of specified doamin.
    Bucket string
    Bucket name.
    CosBucketDomainCertificateAttachmentId string
    ID of the resource.
    DomainCertificate CosBucketDomainCertificateAttachmentDomainCertificateArgs
    The certificate of specified doamin.
    bucket String
    Bucket name.
    cosBucketDomainCertificateAttachmentId String
    ID of the resource.
    domainCertificate CosBucketDomainCertificateAttachmentDomainCertificate
    The certificate of specified doamin.
    bucket string
    Bucket name.
    cosBucketDomainCertificateAttachmentId string
    ID of the resource.
    domainCertificate CosBucketDomainCertificateAttachmentDomainCertificate
    The certificate of specified doamin.
    bucket String
    Bucket name.
    cosBucketDomainCertificateAttachmentId String
    ID of the resource.
    domainCertificate Property Map
    The certificate of specified doamin.

    Supporting Types

    CosBucketDomainCertificateAttachmentDomainCertificate, CosBucketDomainCertificateAttachmentDomainCertificateArgs

    certificate Property Map
    Certificate info.
    domain String
    The name of domain.

    CosBucketDomainCertificateAttachmentDomainCertificateCertificate, CosBucketDomainCertificateAttachmentDomainCertificateCertificateArgs

    certType String
    Certificate type.
    customCert Property Map
    Custom certificate.

    CosBucketDomainCertificateAttachmentDomainCertificateCertificateCustomCert, CosBucketDomainCertificateAttachmentDomainCertificateCertificateCustomCertArgs

    Cert string
    Public key of certificate.
    PrivateKey string
    Private key of certificate.
    CertId string
    ID of certificate.
    Cert string
    Public key of certificate.
    PrivateKey string
    Private key of certificate.
    CertId string
    ID of certificate.
    cert String
    Public key of certificate.
    privateKey String
    Private key of certificate.
    certId String
    ID of certificate.
    cert string
    Public key of certificate.
    privateKey string
    Private key of certificate.
    certId string
    ID of certificate.
    cert str
    Public key of certificate.
    private_key str
    Private key of certificate.
    cert_id str
    ID of certificate.
    cert String
    Public key of certificate.
    privateKey String
    Private key of certificate.
    certId String
    ID of certificate.

    Package Details

    Repository
    tencentcloud tencentcloudstack/terraform-provider-tencentcloud
    License
    Notes
    This Pulumi package is based on the tencentcloud Terraform Provider.
    tencentcloud logo
    tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack