alicloud logo
Alibaba Cloud v3.37.0, May 15 23

alicloud.cas.Certificate

Explore with Pulumi AI

Deprecated:

This resource has been deprecated in favour of ServiceCertificate

DEPRECATED: This datasource has been deprecated from version 1.129.0. Please use new datasource alicloud_ssl_certificates_service_certificate.

Provides a CAS Certificate resource.

NOTE: The Certificate name which you want to add must be already registered and had not added by another account. Every Certificate name can only exist in a unique group.

NOTE: The Cas Certificate region only support cn-hangzhou, ap-south-1, me-east-1, eu-central-1, ap-northeast-1, ap-southeast-2.

NOTE: Available in 1.35.0+ .

Example Usage

using System.Collections.Generic;
using System.IO;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    // Add a new Certificate.
    var cert = new AliCloud.Cas.Certificate("cert", new()
    {
        Cert = File.ReadAllText($"{path.Module}/test.crt"),
        Key = File.ReadAllText($"{path.Module}/test.key"),
    });

});
package main

import (
	"fmt"
	"os"

	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cas"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func readFileOrPanic(path string) pulumi.StringPtrInput {
	data, err := os.ReadFile(path)
	if err != nil {
		panic(err.Error())
	}
	return pulumi.String(string(data))
}

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cas.NewCertificate(ctx, "cert", &cas.CertificateArgs{
			Cert: readFileOrPanic(fmt.Sprintf("%v/test.crt", path.Module)),
			Key:  readFileOrPanic(fmt.Sprintf("%v/test.key", path.Module)),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.cas.Certificate;
import com.pulumi.alicloud.cas.CertificateArgs;
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) {
        var cert = new Certificate("cert", CertificateArgs.builder()        
            .cert(Files.readString(Paths.get(String.format("%s/test.crt", path.module()))))
            .key(Files.readString(Paths.get(String.format("%s/test.key", path.module()))))
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

# Add a new Certificate.
cert = alicloud.cas.Certificate("cert",
    cert=(lambda path: open(path).read())(f"{path['module']}/test.crt"),
    key=(lambda path: open(path).read())(f"{path['module']}/test.key"))
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as fs from "fs";

// Add a new Certificate.
const cert = new alicloud.cas.Certificate("cert", {
    cert: fs.readFileSync(`${path.module}/test.crt`),
    key: fs.readFileSync(`${path.module}/test.key`),
});
resources:
  # Add a new Certificate.
  cert:
    type: alicloud:cas:Certificate
    properties:
      cert:
        fn::readFile: ${path.module}/test.crt
      key:
        fn::readFile: ${path.module}/test.key

Create Certificate Resource

new Certificate(name: string, args: CertificateArgs, opts?: CustomResourceOptions);
@overload
def Certificate(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                cert: Optional[str] = None,
                certificate_name: Optional[str] = None,
                key: Optional[str] = None,
                lang: Optional[str] = None,
                name: Optional[str] = None)
@overload
def Certificate(resource_name: str,
                args: CertificateArgs,
                opts: Optional[ResourceOptions] = None)
func NewCertificate(ctx *Context, name string, args CertificateArgs, opts ...ResourceOption) (*Certificate, error)
public Certificate(string name, CertificateArgs args, CustomResourceOptions? opts = null)
public Certificate(String name, CertificateArgs args)
public Certificate(String name, CertificateArgs args, CustomResourceOptions options)
type: alicloud:cas:Certificate
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args CertificateArgs
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 CertificateArgs
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 CertificateArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args CertificateArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args CertificateArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Certificate Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Certificate resource accepts the following input properties:

Cert string

Cert of the Certificate in which the Certificate will add.

Key string

Key of the Certificate in which the Certificate will add.

CertificateName string
Lang string
Name string

Name of the Certificate. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.

Deprecated:

attribute 'name' has been deprecated from provider version 1.129.0 and it will be remove in the future version. Please use the new attribute 'certificate_name' instead.

Cert string

Cert of the Certificate in which the Certificate will add.

Key string

Key of the Certificate in which the Certificate will add.

CertificateName string
Lang string
Name string

Name of the Certificate. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.

Deprecated:

attribute 'name' has been deprecated from provider version 1.129.0 and it will be remove in the future version. Please use the new attribute 'certificate_name' instead.

cert String

Cert of the Certificate in which the Certificate will add.

key String

Key of the Certificate in which the Certificate will add.

certificateName String
lang String
name String

Name of the Certificate. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.

Deprecated:

attribute 'name' has been deprecated from provider version 1.129.0 and it will be remove in the future version. Please use the new attribute 'certificate_name' instead.

cert string

Cert of the Certificate in which the Certificate will add.

key string

Key of the Certificate in which the Certificate will add.

certificateName string
lang string
name string

Name of the Certificate. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.

Deprecated:

attribute 'name' has been deprecated from provider version 1.129.0 and it will be remove in the future version. Please use the new attribute 'certificate_name' instead.

cert str

Cert of the Certificate in which the Certificate will add.

key str

Key of the Certificate in which the Certificate will add.

certificate_name str
lang str
name str

Name of the Certificate. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.

Deprecated:

attribute 'name' has been deprecated from provider version 1.129.0 and it will be remove in the future version. Please use the new attribute 'certificate_name' instead.

cert String

Cert of the Certificate in which the Certificate will add.

key String

Key of the Certificate in which the Certificate will add.

certificateName String
lang String
name String

Name of the Certificate. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.

Deprecated:

attribute 'name' has been deprecated from provider version 1.129.0 and it will be remove in the future version. Please use the new attribute 'certificate_name' instead.

Outputs

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

Get an existing Certificate 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?: CertificateState, opts?: CustomResourceOptions): Certificate
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        cert: Optional[str] = None,
        certificate_name: Optional[str] = None,
        key: Optional[str] = None,
        lang: Optional[str] = None,
        name: Optional[str] = None) -> Certificate
func GetCertificate(ctx *Context, name string, id IDInput, state *CertificateState, opts ...ResourceOption) (*Certificate, error)
public static Certificate Get(string name, Input<string> id, CertificateState? state, CustomResourceOptions? opts = null)
public static Certificate get(String name, Output<String> id, CertificateState 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.
The following state arguments are supported:
Cert string

Cert of the Certificate in which the Certificate will add.

CertificateName string
Key string

Key of the Certificate in which the Certificate will add.

Lang string
Name string

Name of the Certificate. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.

Deprecated:

attribute 'name' has been deprecated from provider version 1.129.0 and it will be remove in the future version. Please use the new attribute 'certificate_name' instead.

Cert string

Cert of the Certificate in which the Certificate will add.

CertificateName string
Key string

Key of the Certificate in which the Certificate will add.

Lang string
Name string

Name of the Certificate. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.

Deprecated:

attribute 'name' has been deprecated from provider version 1.129.0 and it will be remove in the future version. Please use the new attribute 'certificate_name' instead.

cert String

Cert of the Certificate in which the Certificate will add.

certificateName String
key String

Key of the Certificate in which the Certificate will add.

lang String
name String

Name of the Certificate. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.

Deprecated:

attribute 'name' has been deprecated from provider version 1.129.0 and it will be remove in the future version. Please use the new attribute 'certificate_name' instead.

cert string

Cert of the Certificate in which the Certificate will add.

certificateName string
key string

Key of the Certificate in which the Certificate will add.

lang string
name string

Name of the Certificate. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.

Deprecated:

attribute 'name' has been deprecated from provider version 1.129.0 and it will be remove in the future version. Please use the new attribute 'certificate_name' instead.

cert str

Cert of the Certificate in which the Certificate will add.

certificate_name str
key str

Key of the Certificate in which the Certificate will add.

lang str
name str

Name of the Certificate. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.

Deprecated:

attribute 'name' has been deprecated from provider version 1.129.0 and it will be remove in the future version. Please use the new attribute 'certificate_name' instead.

cert String

Cert of the Certificate in which the Certificate will add.

certificateName String
key String

Key of the Certificate in which the Certificate will add.

lang String
name String

Name of the Certificate. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix .sh and .tel are not supported.

Deprecated:

attribute 'name' has been deprecated from provider version 1.129.0 and it will be remove in the future version. Please use the new attribute 'certificate_name' instead.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.