Certificate
The ACM certificate resource allows requesting and management of certificates from the Amazon Certificate Manager.
It deals with requesting certificates and managing their attributes and life-cycle.
This resource does not deal with validation of a certificate but can provide inputs
for other resources implementing the validation. It does not wait for a certificate to be issued.
Use a aws.acm.CertificateValidation resource for this.
Most commonly, this resource is used together with aws.route53.Record and
aws.acm.CertificateValidation to request a DNS validated certificate,
deploy the required validation records and wait for validation to complete.
Domain validation through E-Mail is also supported but should be avoided as it requires a manual step outside of this provider.
It’s recommended to specify create_before_destroy = true in a lifecycle block to replace a certificate
which is currently in use (eg, by aws.lb.Listener).
Example Usage
Certificate creation
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var cert = new Aws.Acm.Certificate("cert", new Aws.Acm.CertificateArgs
{
DomainName = "example.com",
Tags =
{
{ "Environment", "test" },
},
ValidationMethod = "DNS",
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/acm"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := acm.NewCertificate(ctx, "cert", &acm.CertificateArgs{
DomainName: pulumi.String("example.com"),
Tags: pulumi.StringMap{
"Environment": pulumi.String("test"),
},
ValidationMethod: pulumi.String("DNS"),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
cert = aws.acm.Certificate("cert",
domain_name="example.com",
tags={
"Environment": "test",
},
validation_method="DNS")import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const cert = new aws.acm.Certificate("cert", {
domainName: "example.com",
tags: {
Environment: "test",
},
validationMethod: "DNS",
});Importing an existing certificate
using Pulumi;
using Aws = Pulumi.Aws;
using Tls = Pulumi.Tls;
class MyStack : Stack
{
public MyStack()
{
var examplePrivateKey = new Tls.PrivateKey("examplePrivateKey", new Tls.PrivateKeyArgs
{
Algorithm = "RSA",
});
var exampleSelfSignedCert = new Tls.SelfSignedCert("exampleSelfSignedCert", new Tls.SelfSignedCertArgs
{
AllowedUses =
{
"key_encipherment",
"digital_signature",
"server_auth",
},
KeyAlgorithm = "RSA",
PrivateKeyPem = examplePrivateKey.PrivateKeyPem,
Subjects =
{
new Tls.Inputs.SelfSignedCertSubjectArgs
{
CommonName = "example.com",
Organization = "ACME Examples, Inc",
},
},
ValidityPeriodHours = 12,
});
var cert = new Aws.Acm.Certificate("cert", new Aws.Acm.CertificateArgs
{
CertificateBody = exampleSelfSignedCert.CertPem,
PrivateKey = examplePrivateKey.PrivateKeyPem,
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/acm"
"github.com/pulumi/pulumi-tls/sdk/v2/go/tls"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
examplePrivateKey, err := tls.NewPrivateKey(ctx, "examplePrivateKey", &tls.PrivateKeyArgs{
Algorithm: pulumi.String("RSA"),
})
if err != nil {
return err
}
exampleSelfSignedCert, err := tls.NewSelfSignedCert(ctx, "exampleSelfSignedCert", &tls.SelfSignedCertArgs{
AllowedUses: pulumi.StringArray{
pulumi.String("key_encipherment"),
pulumi.String("digital_signature"),
pulumi.String("server_auth"),
},
KeyAlgorithm: pulumi.String("RSA"),
PrivateKeyPem: examplePrivateKey.PrivateKeyPem,
Subjects: tls.SelfSignedCertSubjectArray{
&tls.SelfSignedCertSubjectArgs{
CommonName: pulumi.String("example.com"),
Organization: pulumi.String("ACME Examples, Inc"),
},
},
ValidityPeriodHours: pulumi.Int(12),
})
if err != nil {
return err
}
_, err = acm.NewCertificate(ctx, "cert", &acm.CertificateArgs{
CertificateBody: exampleSelfSignedCert.CertPem,
PrivateKey: examplePrivateKey.PrivateKeyPem,
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
import pulumi_tls as tls
example_private_key = tls.PrivateKey("examplePrivateKey", algorithm="RSA")
example_self_signed_cert = tls.SelfSignedCert("exampleSelfSignedCert",
allowed_uses=[
"key_encipherment",
"digital_signature",
"server_auth",
],
key_algorithm="RSA",
private_key_pem=example_private_key.private_key_pem,
subjects=[{
"commonName": "example.com",
"organization": "ACME Examples, Inc",
}],
validity_period_hours=12)
cert = aws.acm.Certificate("cert",
certificate_body=example_self_signed_cert.cert_pem,
private_key=example_private_key.private_key_pem)import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as tls from "@pulumi/tls";
const examplePrivateKey = new tls.PrivateKey("example", {
algorithm: "RSA",
});
const exampleSelfSignedCert = new tls.SelfSignedCert("example", {
allowedUses: [
"key_encipherment",
"digital_signature",
"server_auth",
],
keyAlgorithm: "RSA",
privateKeyPem: examplePrivateKey.privateKeyPem,
subjects: [{
commonName: "example.com",
organization: "ACME Examples, Inc",
}],
validityPeriodHours: 12,
});
const cert = new aws.acm.Certificate("cert", {
certificateBody: exampleSelfSignedCert.certPem,
privateKey: examplePrivateKey.privateKeyPem,
});Create a Certificate Resource
new Certificate(name: string, args?: CertificateArgs, opts?: CustomResourceOptions);def Certificate(resource_name, opts=None, certificate_authority_arn=None, certificate_body=None, certificate_chain=None, domain_name=None, options=None, private_key=None, subject_alternative_names=None, tags=None, validation_method=None, __props__=None);func NewCertificate(ctx *Context, name string, args *CertificateArgs, opts ...ResourceOption) (*Certificate, error)public Certificate(string name, CertificateArgs? args = null, CustomResourceOptions? opts = null)- 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.
- opts ResourceOptions
- A bag of options that control this 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.
Certificate Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The Certificate resource accepts the following input properties:
- string
ARN of an ACMPCA
- Certificate
Body string The certificate’s PEM-formatted public key
- Certificate
Chain string The certificate’s PEM-formatted chain * Creating a private CA issued certificate
- Domain
Name string A domain name for which the certificate should be issued
- Options
Certificate
Options Args Configuration block used to set certificate options. Detailed below. * Importing an existing certificate
- Private
Key string The certificate’s PEM-formatted private key
- Subject
Alternative List<string>Names A list of domains that should be SANs in the issued certificate. To remove all elements of a previously configured list, set this value equal to an empty list (
[]) to trigger recreation.- Dictionary<string, string>
A map of tags to assign to the resource.
- Validation
Method string Which method to use for validation.
DNSorEMAILare valid,NONEcan be used for certificates that were imported into ACM and then into the provider.
- string
ARN of an ACMPCA
- Certificate
Body string The certificate’s PEM-formatted public key
- Certificate
Chain string The certificate’s PEM-formatted chain * Creating a private CA issued certificate
- Domain
Name string A domain name for which the certificate should be issued
- Options
Certificate
Options Configuration block used to set certificate options. Detailed below. * Importing an existing certificate
- Private
Key string The certificate’s PEM-formatted private key
- Subject
Alternative []stringNames A list of domains that should be SANs in the issued certificate. To remove all elements of a previously configured list, set this value equal to an empty list (
[]) to trigger recreation.- map[string]string
A map of tags to assign to the resource.
- Validation
Method string Which method to use for validation.
DNSorEMAILare valid,NONEcan be used for certificates that were imported into ACM and then into the provider.
- string
ARN of an ACMPCA
- certificate
Body string The certificate’s PEM-formatted public key
- certificate
Chain string The certificate’s PEM-formatted chain * Creating a private CA issued certificate
- domain
Name string A domain name for which the certificate should be issued
- options
Certificate
Options Configuration block used to set certificate options. Detailed below. * Importing an existing certificate
- private
Key string The certificate’s PEM-formatted private key
- subject
Alternative string[]Names A list of domains that should be SANs in the issued certificate. To remove all elements of a previously configured list, set this value equal to an empty list (
[]) to trigger recreation.- {[key: string]: string}
A map of tags to assign to the resource.
- validation
Method string Which method to use for validation.
DNSorEMAILare valid,NONEcan be used for certificates that were imported into ACM and then into the provider.
- str
ARN of an ACMPCA
- certificate_
body str The certificate’s PEM-formatted public key
- certificate_
chain str The certificate’s PEM-formatted chain * Creating a private CA issued certificate
- domain_
name str A domain name for which the certificate should be issued
- options
Dict[Certificate
Options] Configuration block used to set certificate options. Detailed below. * Importing an existing certificate
- private_
key str The certificate’s PEM-formatted private key
- subject_
alternative_ List[str]names A list of domains that should be SANs in the issued certificate. To remove all elements of a previously configured list, set this value equal to an empty list (
[]) to trigger recreation.- Dict[str, str]
A map of tags to assign to the resource.
- validation_
method str Which method to use for validation.
DNSorEMAILare valid,NONEcan be used for certificates that were imported into ACM and then into the provider.
Outputs
All input properties are implicitly available as output properties. Additionally, the Certificate resource produces the following output properties:
- Arn string
The ARN of the certificate
- Domain
Validation List<CertificateOptions Domain Validation Option> A list of attributes to feed into other resources to complete certificate validation. Can have more than one element, e.g. if SANs are defined. Only set if
DNS-validation was used.- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
Status of the certificate.
- Validation
Emails List<string> A list of addresses that received a validation E-Mail. Only set if
EMAIL-validation was used.
- Arn string
The ARN of the certificate
- Domain
Validation []CertificateOptions Domain Validation Option A list of attributes to feed into other resources to complete certificate validation. Can have more than one element, e.g. if SANs are defined. Only set if
DNS-validation was used.- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
Status of the certificate.
- Validation
Emails []string A list of addresses that received a validation E-Mail. Only set if
EMAIL-validation was used.
- arn string
The ARN of the certificate
- domain
Validation CertificateOptions Domain Validation Option[] A list of attributes to feed into other resources to complete certificate validation. Can have more than one element, e.g. if SANs are defined. Only set if
DNS-validation was used.- id string
- The provider-assigned unique ID for this managed resource.
- status string
Status of the certificate.
- validation
Emails string[] A list of addresses that received a validation E-Mail. Only set if
EMAIL-validation was used.
- arn str
The ARN of the certificate
- domain_
validation_ List[Certificateoptions Domain Validation Option] A list of attributes to feed into other resources to complete certificate validation. Can have more than one element, e.g. if SANs are defined. Only set if
DNS-validation was used.- id str
- The provider-assigned unique ID for this managed resource.
- status str
Status of the certificate.
- validation_
emails List[str] A list of addresses that received a validation E-Mail. Only set if
EMAIL-validation was used.
Look up an 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): Certificatestatic get(resource_name, id, opts=None, arn=None, certificate_authority_arn=None, certificate_body=None, certificate_chain=None, domain_name=None, domain_validation_options=None, options=None, private_key=None, status=None, subject_alternative_names=None, tags=None, validation_emails=None, validation_method=None, __props__=None);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)- 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.
The following state arguments are supported:
- Arn string
The ARN of the certificate
- string
ARN of an ACMPCA
- Certificate
Body string The certificate’s PEM-formatted public key
- Certificate
Chain string The certificate’s PEM-formatted chain * Creating a private CA issued certificate
- Domain
Name string A domain name for which the certificate should be issued
- Domain
Validation List<CertificateOptions Domain Validation Option Args> A list of attributes to feed into other resources to complete certificate validation. Can have more than one element, e.g. if SANs are defined. Only set if
DNS-validation was used.- Options
Certificate
Options Args Configuration block used to set certificate options. Detailed below. * Importing an existing certificate
- Private
Key string The certificate’s PEM-formatted private key
- Status string
Status of the certificate.
- Subject
Alternative List<string>Names A list of domains that should be SANs in the issued certificate. To remove all elements of a previously configured list, set this value equal to an empty list (
[]) to trigger recreation.- Dictionary<string, string>
A map of tags to assign to the resource.
- Validation
Emails List<string> A list of addresses that received a validation E-Mail. Only set if
EMAIL-validation was used.- Validation
Method string Which method to use for validation.
DNSorEMAILare valid,NONEcan be used for certificates that were imported into ACM and then into the provider.
- Arn string
The ARN of the certificate
- string
ARN of an ACMPCA
- Certificate
Body string The certificate’s PEM-formatted public key
- Certificate
Chain string The certificate’s PEM-formatted chain * Creating a private CA issued certificate
- Domain
Name string A domain name for which the certificate should be issued
- Domain
Validation []CertificateOptions Domain Validation Option A list of attributes to feed into other resources to complete certificate validation. Can have more than one element, e.g. if SANs are defined. Only set if
DNS-validation was used.- Options
Certificate
Options Configuration block used to set certificate options. Detailed below. * Importing an existing certificate
- Private
Key string The certificate’s PEM-formatted private key
- Status string
Status of the certificate.
- Subject
Alternative []stringNames A list of domains that should be SANs in the issued certificate. To remove all elements of a previously configured list, set this value equal to an empty list (
[]) to trigger recreation.- map[string]string
A map of tags to assign to the resource.
- Validation
Emails []string A list of addresses that received a validation E-Mail. Only set if
EMAIL-validation was used.- Validation
Method string Which method to use for validation.
DNSorEMAILare valid,NONEcan be used for certificates that were imported into ACM and then into the provider.
- arn string
The ARN of the certificate
- string
ARN of an ACMPCA
- certificate
Body string The certificate’s PEM-formatted public key
- certificate
Chain string The certificate’s PEM-formatted chain * Creating a private CA issued certificate
- domain
Name string A domain name for which the certificate should be issued
- domain
Validation CertificateOptions Domain Validation Option[] A list of attributes to feed into other resources to complete certificate validation. Can have more than one element, e.g. if SANs are defined. Only set if
DNS-validation was used.- options
Certificate
Options Configuration block used to set certificate options. Detailed below. * Importing an existing certificate
- private
Key string The certificate’s PEM-formatted private key
- status string
Status of the certificate.
- subject
Alternative string[]Names A list of domains that should be SANs in the issued certificate. To remove all elements of a previously configured list, set this value equal to an empty list (
[]) to trigger recreation.- {[key: string]: string}
A map of tags to assign to the resource.
- validation
Emails string[] A list of addresses that received a validation E-Mail. Only set if
EMAIL-validation was used.- validation
Method string Which method to use for validation.
DNSorEMAILare valid,NONEcan be used for certificates that were imported into ACM and then into the provider.
- arn str
The ARN of the certificate
- str
ARN of an ACMPCA
- certificate_
body str The certificate’s PEM-formatted public key
- certificate_
chain str The certificate’s PEM-formatted chain * Creating a private CA issued certificate
- domain_
name str A domain name for which the certificate should be issued
- domain_
validation_ List[Certificateoptions Domain Validation Option] A list of attributes to feed into other resources to complete certificate validation. Can have more than one element, e.g. if SANs are defined. Only set if
DNS-validation was used.- options
Dict[Certificate
Options] Configuration block used to set certificate options. Detailed below. * Importing an existing certificate
- private_
key str The certificate’s PEM-formatted private key
- status str
Status of the certificate.
- subject_
alternative_ List[str]names A list of domains that should be SANs in the issued certificate. To remove all elements of a previously configured list, set this value equal to an empty list (
[]) to trigger recreation.- Dict[str, str]
A map of tags to assign to the resource.
- validation_
emails List[str] A list of addresses that received a validation E-Mail. Only set if
EMAIL-validation was used.- validation_
method str Which method to use for validation.
DNSorEMAILare valid,NONEcan be used for certificates that were imported into ACM and then into the provider.
Supporting Types
CertificateDomainValidationOption
See the output API doc for this type.
See the output API doc for this type.
See the output API doc for this type.
- Domain
Name string A domain name for which the certificate should be issued
- Resource
Record stringName The name of the DNS record to create to validate the certificate
- Resource
Record stringType The type of DNS record to create
- Resource
Record stringValue The value the DNS record needs to have
- Domain
Name string A domain name for which the certificate should be issued
- Resource
Record stringName The name of the DNS record to create to validate the certificate
- Resource
Record stringType The type of DNS record to create
- Resource
Record stringValue The value the DNS record needs to have
- domain
Name string A domain name for which the certificate should be issued
- resource
Record stringName The name of the DNS record to create to validate the certificate
- resource
Record stringType The type of DNS record to create
- resource
Record stringValue The value the DNS record needs to have
- domain_
name str A domain name for which the certificate should be issued
- resource
Record strName The name of the DNS record to create to validate the certificate
- resource
Record strType The type of DNS record to create
- resource
Record strValue The value the DNS record needs to have
CertificateOptions
- Certificate
Transparency stringLogging Preference Specifies whether certificate details should be added to a certificate transparency log. Valid values are
ENABLEDorDISABLED. See https://docs.aws.amazon.com/acm/latest/userguide/acm-concepts.html#concept-transparency for more details.
- Certificate
Transparency stringLogging Preference Specifies whether certificate details should be added to a certificate transparency log. Valid values are
ENABLEDorDISABLED. See https://docs.aws.amazon.com/acm/latest/userguide/acm-concepts.html#concept-transparency for more details.
- certificate
Transparency stringLogging Preference Specifies whether certificate details should be added to a certificate transparency log. Valid values are
ENABLEDorDISABLED. See https://docs.aws.amazon.com/acm/latest/userguide/acm-concepts.html#concept-transparency for more details.
- certificate
Transparency strLogging Preference Specifies whether certificate details should be added to a certificate transparency log. Valid values are
ENABLEDorDISABLED. See https://docs.aws.amazon.com/acm/latest/userguide/acm-concepts.html#concept-transparency for more details.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.