Welcome to Pulumi Registry, your window into the cloud. Read the announcement.

AWS Classic

v4.29.0 published on Monday, Nov 22, 2021 by Pulumi

getCertificate

Use this data source to get the ARN of a certificate in AWS Certificate Manager (ACM), you can reference it by domain without having to hard code the ARNs as input.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var issued = Output.Create(Aws.Acm.GetCertificate.InvokeAsync(new Aws.Acm.GetCertificateArgs
        {
            Domain = "tf.example.com",
            Statuses = 
            {
                "ISSUED",
            },
        }));
        var amazonIssued = Output.Create(Aws.Acm.GetCertificate.InvokeAsync(new Aws.Acm.GetCertificateArgs
        {
            Domain = "tf.example.com",
            MostRecent = true,
            Types = 
            {
                "AMAZON_ISSUED",
            },
        }));
        var rsa4096 = Output.Create(Aws.Acm.GetCertificate.InvokeAsync(new Aws.Acm.GetCertificateArgs
        {
            Domain = "tf.example.com",
            KeyTypes = 
            {
                "RSA_4096",
            },
        }));
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/acm"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := acm.LookupCertificate(ctx, &acm.LookupCertificateArgs{
			Domain: "tf.example.com",
			Statuses: []string{
				"ISSUED",
			},
		}, nil)
		if err != nil {
			return err
		}
		opt0 := true
		_, err = acm.LookupCertificate(ctx, &acm.LookupCertificateArgs{
			Domain:     "tf.example.com",
			MostRecent: &opt0,
			Types: []string{
				"AMAZON_ISSUED",
			},
		}, nil)
		if err != nil {
			return err
		}
		_, err = acm.LookupCertificate(ctx, &acm.LookupCertificateArgs{
			Domain: "tf.example.com",
			KeyTypes: []string{
				"RSA_4096",
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

issued = aws.acm.get_certificate(domain="tf.example.com",
    statuses=["ISSUED"])
amazon_issued = aws.acm.get_certificate(domain="tf.example.com",
    most_recent=True,
    types=["AMAZON_ISSUED"])
rsa4096 = aws.acm.get_certificate(domain="tf.example.com",
    key_types=["RSA_4096"])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

// Find a certificate that is issued
const issued = pulumi.output(aws.acm.getCertificate({
    domain: "tf.example.com",
    statuses: ["ISSUED"],
}));
// Find a certificate issued by (not imported into) ACM
const amazonIssued = pulumi.output(aws.acm.getCertificate({
    domain: "tf.example.com",
    mostRecent: true,
    types: ["AMAZON_ISSUED"],
}));
// Find a RSA 4096 bit certificate
const rsa4096 = pulumi.output(aws.acm.getCertificate({
    domain: "tf.example.com",
    keyTypes: ["RSA_4096"],
}));

Using getCertificate

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getCertificate(args: GetCertificateArgs, opts?: InvokeOptions): Promise<GetCertificateResult>
function getCertificateOutput(args: GetCertificateOutputArgs, opts?: InvokeOptions): Output<GetCertificateResult>
def get_certificate(domain: Optional[str] = None,
                    key_types: Optional[Sequence[str]] = None,
                    most_recent: Optional[bool] = None,
                    statuses: Optional[Sequence[str]] = None,
                    tags: Optional[Mapping[str, str]] = None,
                    types: Optional[Sequence[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> GetCertificateResult
def get_certificate_output(domain: Optional[pulumi.Input[str]] = None,
                    key_types: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                    most_recent: Optional[pulumi.Input[bool]] = None,
                    statuses: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                    tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                    types: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetCertificateResult]
func LookupCertificate(ctx *Context, args *LookupCertificateArgs, opts ...InvokeOption) (*LookupCertificateResult, error)
func LookupCertificateOutput(ctx *Context, args *LookupCertificateOutputArgs, opts ...InvokeOption) LookupCertificateResultOutput

> Note: This function is named LookupCertificate in the Go SDK.

public static class GetCertificate 
{
    public static Task<GetCertificateResult> InvokeAsync(GetCertificateArgs args, InvokeOptions? opts = null)
    public static Output<GetCertificateResult> Invoke(GetCertificateInvokeArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Domain string
The domain of the certificate to look up. If no certificate is found with this name, an error will be returned.
KeyTypes List<string>
A list of key algorithms to filter certificates. By default, ACM does not return all certificate types when searching. Valid values are RSA_1024, RSA_2048, RSA_4096, EC_prime256v1, EC_secp384r1, and EC_secp521r1.
MostRecent bool
If set to true, it sorts the certificates matched by previous criteria by the NotBefore field, returning only the most recent one. If set to false, it returns an error if more than one certificate is found. Defaults to false.
Statuses List<string>
A list of statuses on which to filter the returned list. Valid values are PENDING_VALIDATION, ISSUED, INACTIVE, EXPIRED, VALIDATION_TIMED_OUT, REVOKED and FAILED. If no value is specified, only certificates in the ISSUED state are returned.
Tags Dictionary<string, string>
A mapping of tags for the resource.
Types List<string>
A list of types on which to filter the returned list. Valid values are AMAZON_ISSUED and IMPORTED.
Domain string
The domain of the certificate to look up. If no certificate is found with this name, an error will be returned.
KeyTypes []string
A list of key algorithms to filter certificates. By default, ACM does not return all certificate types when searching. Valid values are RSA_1024, RSA_2048, RSA_4096, EC_prime256v1, EC_secp384r1, and EC_secp521r1.
MostRecent bool
If set to true, it sorts the certificates matched by previous criteria by the NotBefore field, returning only the most recent one. If set to false, it returns an error if more than one certificate is found. Defaults to false.
Statuses []string
A list of statuses on which to filter the returned list. Valid values are PENDING_VALIDATION, ISSUED, INACTIVE, EXPIRED, VALIDATION_TIMED_OUT, REVOKED and FAILED. If no value is specified, only certificates in the ISSUED state are returned.
Tags map[string]string
A mapping of tags for the resource.
Types []string
A list of types on which to filter the returned list. Valid values are AMAZON_ISSUED and IMPORTED.
domain string
The domain of the certificate to look up. If no certificate is found with this name, an error will be returned.
keyTypes string[]
A list of key algorithms to filter certificates. By default, ACM does not return all certificate types when searching. Valid values are RSA_1024, RSA_2048, RSA_4096, EC_prime256v1, EC_secp384r1, and EC_secp521r1.
mostRecent boolean
If set to true, it sorts the certificates matched by previous criteria by the NotBefore field, returning only the most recent one. If set to false, it returns an error if more than one certificate is found. Defaults to false.
statuses string[]
A list of statuses on which to filter the returned list. Valid values are PENDING_VALIDATION, ISSUED, INACTIVE, EXPIRED, VALIDATION_TIMED_OUT, REVOKED and FAILED. If no value is specified, only certificates in the ISSUED state are returned.
tags {[key: string]: string}
A mapping of tags for the resource.
types string[]
A list of types on which to filter the returned list. Valid values are AMAZON_ISSUED and IMPORTED.
domain str
The domain of the certificate to look up. If no certificate is found with this name, an error will be returned.
key_types Sequence[str]
A list of key algorithms to filter certificates. By default, ACM does not return all certificate types when searching. Valid values are RSA_1024, RSA_2048, RSA_4096, EC_prime256v1, EC_secp384r1, and EC_secp521r1.
most_recent bool
If set to true, it sorts the certificates matched by previous criteria by the NotBefore field, returning only the most recent one. If set to false, it returns an error if more than one certificate is found. Defaults to false.
statuses Sequence[str]
A list of statuses on which to filter the returned list. Valid values are PENDING_VALIDATION, ISSUED, INACTIVE, EXPIRED, VALIDATION_TIMED_OUT, REVOKED and FAILED. If no value is specified, only certificates in the ISSUED state are returned.
tags Mapping[str, str]
A mapping of tags for the resource.
types Sequence[str]
A list of types on which to filter the returned list. Valid values are AMAZON_ISSUED and IMPORTED.

getCertificate Result

The following output properties are available:

Arn string
Amazon Resource Name (ARN) of the found certificate, suitable for referencing in other resources that support ACM certificates.
Domain string
Id string
The provider-assigned unique ID for this managed resource.
Status string
Status of the found certificate.
Tags Dictionary<string, string>
A mapping of tags for the resource.
KeyTypes List<string>
MostRecent bool
Statuses List<string>
Types List<string>
Arn string
Amazon Resource Name (ARN) of the found certificate, suitable for referencing in other resources that support ACM certificates.
Domain string
Id string
The provider-assigned unique ID for this managed resource.
Status string
Status of the found certificate.
Tags map[string]string
A mapping of tags for the resource.
KeyTypes []string
MostRecent bool
Statuses []string
Types []string
arn string
Amazon Resource Name (ARN) of the found certificate, suitable for referencing in other resources that support ACM certificates.
domain string
id string
The provider-assigned unique ID for this managed resource.
status string
Status of the found certificate.
tags {[key: string]: string}
A mapping of tags for the resource.
keyTypes string[]
mostRecent boolean
statuses string[]
types string[]
arn str
Amazon Resource Name (ARN) of the found certificate, suitable for referencing in other resources that support ACM certificates.
domain str
id str
The provider-assigned unique ID for this managed resource.
status str
Status of the found certificate.
tags Mapping[str, str]
A mapping of tags for the resource.
key_types Sequence[str]
most_recent bool
statuses Sequence[str]
types Sequence[str]

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.