aws logo
AWS Classic v5.41.0, May 15 23

aws.acm.CertificateValidation

Explore with Pulumi AI

Example Usage

DNS Validation with Route 53

using Pulumi;
using Pulumi.Aws.Acm;
using Pulumi.Aws.Route53;
using System.Collections.Generic;

return await Deployment.RunAsync(() =>
{
   var exampleCertificate = new Certificate("exampleCertificate", new CertificateArgs
   {
      DomainName = "example.com",
      ValidationMethod = "DNS"
   });

   var exampleZone = GetZone.Invoke(new GetZoneInvokeArgs
   {
      Name = "example.com",
      PrivateZone = false,
   });

   var certValidation = new Record("certValidation", new RecordArgs
   {
      Name = exampleCertificate.DomainValidationOptions.Apply(options => options[0].ResourceRecordName!),
      Records =
      {
         exampleCertificate.DomainValidationOptions.Apply(options => options[0].ResourceRecordValue!),
      },
      Ttl = 60,
      Type = exampleCertificate.DomainValidationOptions.Apply(options => options[0].ResourceRecordType!),
      ZoneId = exampleZone.Apply(zone => zone.Id),
   });

   var certCertificateValidation = new CertificateValidation("cert", new CertificateValidationArgs
   {
      CertificateArn = exampleCertificate.Arn,
      ValidationRecordFqdns =
      {
         certValidation.Fqdn,
      },
   });
   
   return new Dictionary<string, object?>
   {
      ["certificateArn"] = certCertificateValidation.CertificateArn,
   };
});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
        exampleCertificate, err := acm.NewCertificate(ctx, "exampleCertificate", &acm.CertificateArgs{
            DomainName:       pulumi.String("example.com"),
            ValidationMethod: pulumi.String("DNS"),
        })
        if err != nil {
            return err
        }
        
        exampleZone, err := route53.LookupZone(ctx, &route53.LookupZoneArgs{
            Name:        pulumi.StringRef("example.com"),
            PrivateZone: pulumi.BoolRef(false),
        }, nil)
        if err != nil {
            return err
        }
        
        domainValidationOption := exampleCertificate.DomainValidationOptions.ApplyT(func(options []acm.CertificateDomainValidationOption) interface{} {
            return options[0]
        })
        
        certValidation, err := route53.NewRecord(ctx, "certValidation", &route53.RecordArgs{
            Name: domainValidationOption.ApplyT(func(option interface{}) string {
                return *option.(acm.CertificateDomainValidationOption).ResourceRecordName
            }).(pulumi.StringOutput),
            Type: domainValidationOption.ApplyT(func(option interface{}) string {
                return *option.(acm.CertificateDomainValidationOption).ResourceRecordType
            }).(pulumi.StringOutput),
            Records: pulumi.StringArray{
                domainValidationOption.ApplyT(func(option interface{}) string {
                    return *option.(acm.CertificateDomainValidationOption).ResourceRecordValue
                }).(pulumi.StringOutput),
            },
            Ttl:    pulumi.Int(10 * 60),
            ZoneId: pulumi.String(exampleZone.ZoneId),
        })
        if err != nil {
            return err
        }
        
        certCertificateValidation, err := acm.NewCertificateValidation(ctx, "cert", &acm.CertificateValidationArgs{
            CertificateArn: exampleCertificate.Arn,
            ValidationRecordFqdns: pulumi.StringArray{
                certValidation.Fqdn,
            },
        })
        if err != nil {
            return err
        }
        
        ctx.Export("certificateArn", certCertificateValidation.CertificateArn)
        
        return nil
    })
}

Coming soon!

import pulumi_aws as aws

example_certificate = aws.acm.Certificate("exampleCertificate",
                                          domain_name="example.com",
                                          validation_method="DNS")

example_zone = aws.route53.getZone(name="example.com",
                                   private_zone=False)

cert_validation = aws.route53.Record("certValidation",
                                     name=example_certificate.domain_validation_options[0].resource_record_name,
                                     records=[example_certificate.domain_validation_options[0].resource_record_value],
                                     ttl=60,
                                     type=example_certificate.domain_validation_options[0].resource_record_type,
                                     zone_id=example_zone.zone_id)

cert_certificate_validation = aws.acm.CertificateValidation("cert",
                                                              certificate_arn=example_certificate.arn,
                                                              validation_record_fqdns=[cert_validation.fdqn])

pulumi.export("certificate_arn", cert_certificate_validation.certificate_arn)
import * as aws from "@pulumi/aws";

const exampleCertificate = new aws.acm.Certificate("exampleCertificate", {
    domainName: "example.com",
    validationMethod: "DNS",
});
const exampleZone = aws.route53.getZone({
    name: "example.com",
    privateZone: false,
});

const certValidation = new aws.route53.Record("certValidation", {
    name: exampleCertificate.domainValidationOptions[0].resourceRecordName,
    records: [exampleCertificate.domainValidationOptions[0].resourceRecordValue],
    ttl: 60,
    type: exampleCertificate.domainValidationOptions[0].resourceRecordType,
    zoneId: exampleZone.then(x => x.zoneId),
});

const certCertificateValidation = new aws.acm.CertificateValidation("cert", {
    certificateArn: exampleCertificate.arn,
    validationRecordFqdns: [certValidation.fqdn],
});

export const certificateArn = certCertificateValidation.certificateArn;
variables:
  zoneId:
    Fn::Invoke:
      Function: aws.route53.getZone
      Arguments:
        name: "example.com"
        privateZone: false
      Return: id
resources:
  exampleCertificate:
    type: aws.acm.Certificate
    properties:
      domainName: "example.com"
      validationMethod: "DNS"
  certValidation:
    type: aws.route53.Record
    properties:
      name: ${exampleCertificate.domainValidationOptions[0].resourceRecordName}
      records: [${exampleCertificate.domainValidationOptions[0].resourceRecordValue}]
      ttl: 60
      type: ${exampleCertificate.domainValidationOptions[0].resourceRecordType}
      zoneId: ${zoneId}
  certCertificateValidation:
    type: aws.acm.CertificateValidation
    properties:
      certificateArn: ${exampleCertificate.arn}
      validationRecordFqdns: [${certValidation.fqdn}]
outputs:
  certificateArn: ${certCertificateValidation.certificateArn}

Email Validation

using Pulumi;
using Pulumi.Aws.Acm;

return await Deployment.RunAsync(() =>
{
   var exampleCertificate = new Certificate("exampleCertificate", new CertificateArgs
   {
      DomainName = "example.com",
      ValidationMethod = "EMAIL"
   });

   var certCertificateValidation = new CertificateValidation("cert", new CertificateValidationArgs
   {
      CertificateArn = exampleCertificate.Arn,
   });
});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
        exampleCertificate, err := acm.NewCertificate(ctx, "exampleCertificate", &acm.CertificateArgs{
            DomainName: pulumi.String("example.com"),
            ValidationMethod: pulumi.String("EMAIL"),
        })
        if err != nil {
            return err
        }
        
        _, err = acm.NewCertificateValidation(ctx, "exampleCertificateValidation", &acm.CertificateValidationArgs{
            CertificateArn: exampleCertificate.Arn,
        })
        if err != nil {
            return err
        }
		return nil
	})
}

Coming soon!

import pulumi_aws as aws

example_certificate = aws.acm.Certificate("exampleCertificate",
                                          domain_name="example.com",
                                          validation_method="EMAIL")

example_certificate_validation = aws.acm.CertificateValidation("exampleCertificateValidation",
                                                               certificate_arn=example_certificate.arn)
import * as aws from "@pulumi/aws";

const exampleCertificate = new aws.acm.Certificate("exampleCertificate", {
    domainName: "example.com",
    validationMethod: "EMAIL",
});

const exampleCertificateValidation = new aws.acm.CertificateValidation("exampleCertificateValidation", {
    certificateArn: exampleCertificate.arn,
});
resources:
  exampleCertificate:
    type: aws.acm.Certificate
    properties:
      domainName: "example.com"
      validationMethod: "EMAIL"
  certCertificateValidation:
    type: aws.acm.CertificateValidation
    properties:
      certificateArn: ${exampleCertificate.arn}

Create CertificateValidation Resource

new CertificateValidation(name: string, args: CertificateValidationArgs, opts?: CustomResourceOptions);
@overload
def CertificateValidation(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          certificate_arn: Optional[str] = None,
                          validation_record_fqdns: Optional[Sequence[str]] = None)
@overload
def CertificateValidation(resource_name: str,
                          args: CertificateValidationArgs,
                          opts: Optional[ResourceOptions] = None)
func NewCertificateValidation(ctx *Context, name string, args CertificateValidationArgs, opts ...ResourceOption) (*CertificateValidation, error)
public CertificateValidation(string name, CertificateValidationArgs args, CustomResourceOptions? opts = null)
public CertificateValidation(String name, CertificateValidationArgs args)
public CertificateValidation(String name, CertificateValidationArgs args, CustomResourceOptions options)
type: aws:acm:CertificateValidation
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

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

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

CertificateArn string

ARN of the certificate that is being validated.

ValidationRecordFqdns List<string>

List of FQDNs that implement the validation. Only valid for DNS validation method ACM certificates. If this is set, the resource can implement additional sanity checks and has an explicit dependency on the resource that is implementing the validation

CertificateArn string

ARN of the certificate that is being validated.

ValidationRecordFqdns []string

List of FQDNs that implement the validation. Only valid for DNS validation method ACM certificates. If this is set, the resource can implement additional sanity checks and has an explicit dependency on the resource that is implementing the validation

certificateArn String

ARN of the certificate that is being validated.

validationRecordFqdns List<String>

List of FQDNs that implement the validation. Only valid for DNS validation method ACM certificates. If this is set, the resource can implement additional sanity checks and has an explicit dependency on the resource that is implementing the validation

certificateArn string

ARN of the certificate that is being validated.

validationRecordFqdns string[]

List of FQDNs that implement the validation. Only valid for DNS validation method ACM certificates. If this is set, the resource can implement additional sanity checks and has an explicit dependency on the resource that is implementing the validation

certificate_arn str

ARN of the certificate that is being validated.

validation_record_fqdns Sequence[str]

List of FQDNs that implement the validation. Only valid for DNS validation method ACM certificates. If this is set, the resource can implement additional sanity checks and has an explicit dependency on the resource that is implementing the validation

certificateArn String

ARN of the certificate that is being validated.

validationRecordFqdns List<String>

List of FQDNs that implement the validation. Only valid for DNS validation method ACM certificates. If this is set, the resource can implement additional sanity checks and has an explicit dependency on the resource that is implementing the validation

Outputs

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

Get an existing CertificateValidation 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?: CertificateValidationState, opts?: CustomResourceOptions): CertificateValidation
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        certificate_arn: Optional[str] = None,
        validation_record_fqdns: Optional[Sequence[str]] = None) -> CertificateValidation
func GetCertificateValidation(ctx *Context, name string, id IDInput, state *CertificateValidationState, opts ...ResourceOption) (*CertificateValidation, error)
public static CertificateValidation Get(string name, Input<string> id, CertificateValidationState? state, CustomResourceOptions? opts = null)
public static CertificateValidation get(String name, Output<String> id, CertificateValidationState 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:
CertificateArn string

ARN of the certificate that is being validated.

ValidationRecordFqdns List<string>

List of FQDNs that implement the validation. Only valid for DNS validation method ACM certificates. If this is set, the resource can implement additional sanity checks and has an explicit dependency on the resource that is implementing the validation

CertificateArn string

ARN of the certificate that is being validated.

ValidationRecordFqdns []string

List of FQDNs that implement the validation. Only valid for DNS validation method ACM certificates. If this is set, the resource can implement additional sanity checks and has an explicit dependency on the resource that is implementing the validation

certificateArn String

ARN of the certificate that is being validated.

validationRecordFqdns List<String>

List of FQDNs that implement the validation. Only valid for DNS validation method ACM certificates. If this is set, the resource can implement additional sanity checks and has an explicit dependency on the resource that is implementing the validation

certificateArn string

ARN of the certificate that is being validated.

validationRecordFqdns string[]

List of FQDNs that implement the validation. Only valid for DNS validation method ACM certificates. If this is set, the resource can implement additional sanity checks and has an explicit dependency on the resource that is implementing the validation

certificate_arn str

ARN of the certificate that is being validated.

validation_record_fqdns Sequence[str]

List of FQDNs that implement the validation. Only valid for DNS validation method ACM certificates. If this is set, the resource can implement additional sanity checks and has an explicit dependency on the resource that is implementing the validation

certificateArn String

ARN of the certificate that is being validated.

validationRecordFqdns List<String>

List of FQDNs that implement the validation. Only valid for DNS validation method ACM certificates. If this is set, the resource can implement additional sanity checks and has an explicit dependency on the resource that is implementing the validation

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.