1. Packages
  2. Packages
  3. Fastly Provider
  4. API Docs
  5. TlsSubscriptionValidation
Viewing docs for Fastly v12.6.0
published on Wednesday, Aug 12, 2026 by Pulumi
fastly logo
Viewing docs for Fastly v12.6.0
published on Wednesday, Aug 12, 2026 by Pulumi

    This resource represents a successful validation of a Fastly TLS Subscription in concert with other resources.

    Most commonly, this resource is used together with a resource for a DNS record and fastly.TlsSubscription to request a DNS validated certificate, deploy the required validation records and wait for validation to complete.

    Warning: This resource implements a part of the validation workflow. It does not represent a real-world entity in Fastly, therefore changing or deleting this resource on its own has no immediate effect.

    Example Usage

    DNS Validation with AWS Route53:

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    import * as fastly from "@pulumi/fastly";
    import * as std from "@pulumi/std";
    
    // NOTE: Creating a hosted zone will automatically create SOA/NS records.
    const production = new aws.index.Route53Zone("production", {name: "example.com"});
    const example = new aws.index.Route53domainsRegisteredDomain("example", {
        nameServer: .map(entry => ({
            name: entry,
        })),
        domainName: "example.com",
    });
    const subdomains = [
        "a.example.com",
        "b.example.com",
    ];
    const exampleServiceVcl = new fastly.ServiceVcl("example", {
        domains: subdomains.map(entry => ({
            name: entry,
        })),
        name: "example-service",
        backends: [{
            address: "127.0.0.1",
            name: "localhost",
        }],
        forceDestroy: true,
    });
    const exampleTlsSubscription = new fastly.TlsSubscription("example", {
        domains: exampleServiceVcl.domains.apply(domains => .map(domain => (domain.name))),
        certificateAuthority: "lets-encrypt",
    });
    const domainValidation: {[key: string]: aws.index.Route53Record} = {};
    exampleTlsSubscription.domains.apply(domains => {
        for (const range of Object.entries(domains.reduce((__obj, domain) => ({ ...__obj, [domain]: exampleTlsSubscription.managedDnsChallenges.apply(managedDnsChallenges => managedDnsChallenges.filter(obj => obj.recordName == `_acme-challenge.${domain}`).map(obj => (obj)))[0] }), {})).sort().map(([k, v]) => ({key: k, value: v}))) {
            domainValidation[range.key] = new aws.index.Route53Record(`domain_validation-${range.key}`, {
                name: range.value.recordName,
                type: range.value.recordType,
                zoneId: production.zoneId,
                allowOverwrite: true,
                records: [range.value.recordValue],
                ttl: 60,
            }, {
            dependsOn: [exampleTlsSubscription],
        });
        }
    });
    // This is a resource that other resources can depend on if they require the certificate to be issued.
    // NOTE: Internally the resource keeps retrying `GetTLSSubscription` until no error is returned (or the configured timeout is reached).
    const exampleTlsSubscriptionValidation = new fastly.TlsSubscriptionValidation("example", {subscriptionId: exampleTlsSubscription.id}, {
        dependsOn: [domainValidation],
    });
    // This data source lists all available configuration objects.
    // It uses a `default` attribute to narrow down the list to just one configuration object.
    // If the filtered list has a length that is not exactly one element, you'll see an error returned.
    // The single TLS configuration is then returned and can be referenced by other resources (see aws_route53_record below).
    //
    // IMPORTANT: Not all customers will have a 'default' configuration.
    // If you have issues filtering with `default = true`, then you may need another attribute.
    // Refer to the fastly_tls_configuration documentation for available attributes:
    // https://registry.terraform.io/providers/fastly/fastly/latest/docs/data-sources/tls_configuration#optional
    const defaultTls = fastly.getTlsConfiguration({
        "default": true,
    });
    // Once validation is complete and we've retrieved the TLS configuration data, we can create multiple subdomain records.
    const subdomain: aws.index.Route53Record[] = [];
    for (let range = 0; range < std.toset({
        input: subdomains,
    }).result; range++) {
        subdomain.push(new aws.index.Route53Record(`subdomain-${range}`, {
            name: range,
            records: .filter(record => record.recordType == "CNAME").map(record => (record.recordValue)),
            ttl: 300,
            type: "CNAME",
            zoneId: production.zoneId,
        }));
    }
    
    import pulumi
    from typing import Any
    import pulumi_aws as aws
    import pulumi_fastly as fastly
    import pulumi_std as std
    
    # NOTE: Creating a hosted zone will automatically create SOA/NS records.
    production = aws.Route53Zone("production", name=example.com)
    example = aws.Route53domainsRegisteredDomain("example",
        name_server=[{
            name: entry,
        } for entry in production.name_servers],
        domain_name=example.com)
    subdomains = [
        "a.example.com",
        "b.example.com",
    ]
    example_service_vcl = fastly.ServiceVcl("example",
        domains=[{
            "name": entry,
        } for entry in subdomains],
        name="example-service",
        backends=[{
            "address": "127.0.0.1",
            "name": "localhost",
        }],
        force_destroy=True)
    example_tls_subscription = fastly.TlsSubscription("example",
        domains=example_service_vcl.domains.apply(lambda domains: [domain.name for domain in domains]),
        certificate_authority="lets-encrypt")
    domain_validation: dict[str, aws.Route53Record] = {}
    def create_domain_validation(range_body):
        for domain_validation_range in [{"key": k, "value": v} for [k, v] in sorted((range_body).items())]:
            domain_validation[domain_validation_range['key']] = aws.Route53Record(f"domain_validation-{domain_validation_range['key']}",
                name=domain_validation_range.value.record_name,
                type=domain_validation_range.value.record_type,
                zone_id=production.zone_id,
                allow_overwrite=True,
                records=[domain_validation_range.value.record_value],
                ttl=60,
                opts = pulumi.ResourceOptions(depends_on=[example_tls_subscription]))
    
    example_tls_subscription.domains.apply(lambda resolved_outputs: create_domain_validation({domain: example_tls_subscription.managed_dns_challenges.apply(lambda managed_dns_challenges: [obj for obj in managed_dns_challenges if obj.record_name == f"_acme-challenge.{domain}"])[0] for domain in resolved_outputs['domains']}))
    # This is a resource that other resources can depend on if they require the certificate to be issued.
    # NOTE: Internally the resource keeps retrying `GetTLSSubscription` until no error is returned (or the configured timeout is reached).
    example_tls_subscription_validation = fastly.TlsSubscriptionValidation("example", subscription_id=example_tls_subscription.id,
    opts = pulumi.ResourceOptions(depends_on=[domain_validation]))
    # This data source lists all available configuration objects.
    # It uses a `default` attribute to narrow down the list to just one configuration object.
    # If the filtered list has a length that is not exactly one element, you'll see an error returned.
    # The single TLS configuration is then returned and can be referenced by other resources (see aws_route53_record below).
    #
    # IMPORTANT: Not all customers will have a 'default' configuration.
    # If you have issues filtering with `default = true`, then you may need another attribute.
    # Refer to the fastly_tls_configuration documentation for available attributes:
    # https://registry.terraform.io/providers/fastly/fastly/latest/docs/data-sources/tls_configuration#optional
    default_tls = fastly.get_tls_configuration(default=True)
    # Once validation is complete and we've retrieved the TLS configuration data, we can create multiple subdomain records.
    subdomain: list[aws.Route53Record] = []
    for subdomain_range in [{"value": i} for i in range(0, std.toset(input=subdomains).result)]:
        subdomain.append(aws.Route53Record(f"subdomain-{subdomain_range['value']}",
            name=subdomain_range.value,
            records=[record.record_value for record in default_tls.dns_records if record.record_type == CNAME],
            ttl=300,
            type=CNAME,
            zone_id=production.zone_id))
    
    Example coming soon!
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    using Fastly = Pulumi.Fastly;
    using Std = Pulumi.Std;
    
    return await Deployment.RunAsync(() => 
    {
        // NOTE: Creating a hosted zone will automatically create SOA/NS records.
        var production = new Aws.Route53Zone("production", new()
        {
            Name = "example.com",
        });
    
        var example = new Aws.Route53domainsRegisteredDomain("example", new()
        {
            NameServer = .Select(entry => 
            {
                return 
                {
                    { "name", entry },
                };
            }).ToList(),
            DomainName = "example.com",
        });
    
        var subdomains = new[]
        {
            "a.example.com",
            "b.example.com",
        };
    
        var exampleServiceVcl = new Fastly.ServiceVcl("example", new()
        {
            Domains = subdomains.Select(entry => 
            {
                return new Fastly.Inputs.ServiceVclDomainArgs
                {
                    Name = entry,
                };
            }).ToList(),
            Name = "example-service",
            Backends = new[]
            {
                new Fastly.Inputs.ServiceVclBackendArgs
                {
                    Address = "127.0.0.1",
                    Name = "localhost",
                },
            },
            ForceDestroy = true,
        });
    
        var exampleTlsSubscription = new Fastly.TlsSubscription("example", new()
        {
            Domains = exampleServiceVcl.Domains.Apply(domains => .Select(domain => 
            {
                return domain.Name;
            }).ToList()),
            CertificateAuthority = "lets-encrypt",
        });
    
        var domainValidation = new List<Aws.Route53Record>();
        foreach (var range in exampleTlsSubscription.Domains.Apply(domains => domains.ToDictionary(item => {
            var domain = item.Value;
            return domain;
        }, item => {
            var domain = item.Value;
            return exampleTlsSubscription.ManagedDnsChallenges.Apply(managedDnsChallenges => managedDnsChallenges.Where(obj => obj.RecordName == $"_acme-challenge.{domain}").Select(obj => 
            {
                return obj;
            }).ToList())[0];
        })).Select(pair => new { pair.Key, pair.Value }))
        {
            domainValidation.Add(new Aws.Route53Record($"domain_validation-{range.Key}", new()
            {
                Name = range.Value.RecordName,
                Type = range.Value.RecordType,
                ZoneId = production.ZoneId,
                AllowOverwrite = true,
                Records = new[]
                {
                    range.Value.RecordValue,
                },
                Ttl = 60,
            }, new CustomResourceOptions
            {
                DependsOn =
                {
                    exampleTlsSubscription,
                },
            }));
        }
        // This is a resource that other resources can depend on if they require the certificate to be issued.
        // NOTE: Internally the resource keeps retrying `GetTLSSubscription` until no error is returned (or the configured timeout is reached).
        var exampleTlsSubscriptionValidation = new Fastly.TlsSubscriptionValidation("example", new()
        {
            SubscriptionId = exampleTlsSubscription.Id,
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                domainValidation,
            },
        });
    
        // This data source lists all available configuration objects.
        // It uses a `default` attribute to narrow down the list to just one configuration object.
        // If the filtered list has a length that is not exactly one element, you'll see an error returned.
        // The single TLS configuration is then returned and can be referenced by other resources (see aws_route53_record below).
        //
        // IMPORTANT: Not all customers will have a 'default' configuration.
        // If you have issues filtering with `default = true`, then you may need another attribute.
        // Refer to the fastly_tls_configuration documentation for available attributes:
        // https://registry.terraform.io/providers/fastly/fastly/latest/docs/data-sources/tls_configuration#optional
        var defaultTls = Fastly.GetTlsConfiguration.Invoke(new()
        {
            Default = true,
        });
    
        // Once validation is complete and we've retrieved the TLS configuration data, we can create multiple subdomain records.
        var subdomain = new List<Aws.Route53Record>();
        for (var rangeIndex = 0; rangeIndex < Std.Toset.Invoke(new()
        {
            Input = subdomains,
        }).Result; rangeIndex++)
        {
            var range = new { Value = rangeIndex };
            subdomain.Add(new Aws.Route53Record($"subdomain-{range.Value}", new()
            {
                Name = range.Value,
                Records = ,
                Ttl = 300,
                Type = "CNAME",
                ZoneId = production.ZoneId,
            }));
        }
    });
    
    Example coming soon!
    
    Example coming soon!
    
    pulumi {
      required_providers {
        aws = {
          source = "pulumi/aws"
        }
        fastly = {
          source = "pulumi/fastly"
        }
      }
    }
    
    data "fastly_gettlsconfiguration" "defaultTls" {
      default = true
    }
    
    # NOTE: Creating a hosted zone will automatically create SOA/NS records.
    resource "aws_route53zone" "production" {
      name = "example.com"
    }
    resource "aws_route53domainsregistereddomain" "example" {
      name_server = [for entry in aws_route53zone.production.nameServers : {
        "name" = entry
      } ]
      domain_name = "example.com"
    }
    resource "fastly_servicevcl" "example" {
      dynamic "domains" {
        for_each = local.subdomains
        content {
          name = domains.value
        }
      }
      name = "example-service"
      backends {
        address = "127.0.0.1"
        name    = "localhost"
      }
      force_destroy = true
    }
    resource "fastly_tlssubscription" "example" {
      domains               = [for domain in fastly_servicevcl.example.domains : domain.name]
      certificate_authority = "lets-encrypt"
    }
    resource "aws_route53record" "domain_validation" {
      for_each        = {for domain in fastly_tlssubscription.example.domains : domain => element([for obj in fastly_tlssubscription.example.managed_dns_challenges : obj if obj.recordName =="_acme-challenge.${domain}"], 0)}
      depends_on      = [fastly_tlssubscription.example]
      name            = each.value.recordName
      type            = each.value.recordType
      zone_id         = aws_route53zone.production.zoneId
      allow_overwrite = true
      records         = [each.value.recordValue]
      ttl             = 60
    }
    # This is a resource that other resources can depend on if they require the certificate to be issued.
    # NOTE: Internally the resource keeps retrying `GetTLSSubscription` until no error is returned (or the configured timeout is reached).
    resource "fastly_tlssubscriptionvalidation" "example" {
      depends_on      = [aws_route53record.domain_validation]
      subscription_id = fastly_tlssubscription.example.id
    }
    # Once validation is complete and we've retrieved the TLS configuration data, we can create multiple subdomain records.
    resource "aws_route53record" "subdomain" {
      for_each = toset(local.subdomains)
      name     = each.value
      records  = [for record in data.fastly_gettlsconfiguration.defaultTls.dns_records : record.recordValue if record.recordType == "CNAME"]
      ttl      = 300
      type     = "CNAME"
      zone_id  = aws_route53zone.production.zoneId
    }
    locals {
      subdomains = ["a.example.com", "b.example.com"]
    }
    # This data source lists all available configuration objects.
    # It uses a `default` attribute to narrow down the list to just one configuration object.
    # If the filtered list has a length that is not exactly one element, you'll see an error returned.
    # The single TLS configuration is then returned and can be referenced by other resources (see aws_route53_record below).
    #
    # IMPORTANT: Not all customers will have a 'default' configuration.
    # If you have issues filtering with `default = true`, then you may need another attribute.
    # Refer to the fastly_tls_configuration documentation for available attributes:
    # https://registry.terraform.io/providers/fastly/fastly/latest/docs/data-sources/tls_configuration#optional
    

    Managed certificates for multiple domains, in a single apply:

    The certificateId attribute is only populated once the certificate has been issued, so resources referencing it are guaranteed to run after issuance — unlike fastly_tls_subscription.<name>.certificate_id, which is empty on first apply (certificates are issued asynchronously after domain validation) and causes API 400 errors when consumed in the same apply.

    Note: Fastly automatically activates TLS on a subscription’s domains once the certificate is issued — set configurationId on the fastly.TlsSubscription itself and do not create a fastly.TlsActivation for those domains (it fails with 400 domainId has already been taken). Use the fastly.TlsActivation data source to read the automatically-created activation.

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    import * as fastly from "@pulumi/fastly";
    
    const config = new pulumi.Config();
    const certificates = config.requireObject<Record<string, {authority?: string, commonName?: string, domains?: Array<string>, forceDestroy?: boolean}>>("certificates");
    const defaultTls = fastly.getTlsConfiguration({
        "default": true,
    });
    const exampleTlsSubscription: {[key: string]: fastly.TlsSubscription} = {};
    for (const range of Object.entries(certificates).sort().map(([k, v]) => ({key: k, value: v}))) {
        exampleTlsSubscription[range.key] = new fastly.TlsSubscription(`example-${range.key}`, {
            certificateAuthority: range.value.authority,
            commonName: range.value.commonName,
            domains: range.value.domains,
            forceDestroy: range.value.forceDestroy,
            configurationId: defaultTls.then(defaultTls => defaultTls.id),
        });
    }
    // The domain validation challenge records MUST be created before validation
    // can succeed. This example uses DNS-based validation: replace with your DNS
    // provider's record resource, fed from
    // fastly_tls_subscription.example[each.key].managed_dns_challenges
    // (see the fastly_tls_subscription documentation for a Route53 example).
    const domainValidation: {[key: string]: aws.index.Route53Record} = {};
    exampleTlsSubscription.apply(rangeBody => {
        for (const range of Object.entries(rangeBody).sort().map(([k, v]) => ({key: k, value: v}))) {
            domainValidation[range.key] = new aws.index.Route53Record(`domain_validation-${range.key}`, {
                name: range.value.managedDnsChallenges[0].recordName,
                type: range.value.managedDnsChallenges[0].recordType,
                records: [range.value.managedDnsChallenges[0].recordValue],
                zoneId: "REPLACE_WITH_YOUR_ZONE_ID",
                allowOverwrite: true,
                ttl: 60,
            });
        }
    });
    // Blocks until the certificate has been issued. Its certificate_id attribute
    // is only known after issuance, so downstream resources referencing it are
    // guaranteed to run with a valid certificate — all in a single apply.
    const exampleTlsSubscriptionValidation: {[key: string]: fastly.TlsSubscriptionValidation} = {};
    for (const range of Object.entries(certificates).sort().map(([k, v]) => ({key: k, value: v}))) {
        exampleTlsSubscriptionValidation[range.key] = new fastly.TlsSubscriptionValidation(`example-${range.key}`, {subscriptionId: exampleTlsSubscription[range.key].id}, {
        dependsOn: [domainValidation],
    });
    }
    // The activation was created automatically by Fastly when the certificate was
    // issued; this data source reads it (e.g. to consume dns_records/IDs).
    const example = Object.entries(certificates).sort().reduce((__obj, [__key, __value]) => ({ ...__obj, [__key]: fastly.getTlsActivation({
        domain: __value.commonName,
    }) }), {});
    export const certificateIds = Object.entries(exampleTlsSubscriptionValidation).sort().reduce((__obj, [k, v]) => ({ ...__obj, [k]: v.certificateId }), {});
    
    import pulumi
    from typing import Any
    import pulumi_aws as aws
    import pulumi_fastly as fastly
    
    config = pulumi.Config()
    certificates = config.require_object("certificates")
    default_tls = fastly.get_tls_configuration(default=True)
    example_tls_subscription: dict[str, fastly.TlsSubscription] = {}
    for example_tls_subscription_range in [{"key": k, "value": v} for [k, v] in sorted((certificates).items())]:
        example_tls_subscription[example_tls_subscription_range['key']] = fastly.TlsSubscription(f"example-{example_tls_subscription_range['key']}",
            certificate_authority=example_tls_subscription_range["value"]["authority"],
            common_name=example_tls_subscription_range["value"]["commonName"],
            domains=example_tls_subscription_range["value"]["domains"],
            force_destroy=example_tls_subscription_range["value"]["forceDestroy"],
            configuration_id=default_tls.id)
    # The domain validation challenge records MUST be created before validation
    # can succeed. This example uses DNS-based validation: replace with your DNS
    # provider's record resource, fed from
    # fastly_tls_subscription.example[each.key].managed_dns_challenges
    # (see the fastly_tls_subscription documentation for a Route53 example).
    domain_validation: dict[str, aws.Route53Record] = {}
    def create_domain_validation(range_body):
        for domain_validation_range in [{"key": k, "value": v} for [k, v] in sorted((range_body).items())]:
            domain_validation[domain_validation_range['key']] = aws.Route53Record(f"domain_validation-{domain_validation_range['key']}",
                name=domain_validation_range.value.managed_dns_challenges[0].record_name,
                type=domain_validation_range.value.managed_dns_challenges[0].record_type,
                records=[domain_validation_range.value.managed_dns_challenges[0].record_value],
                zone_id=REPLACE_WITH_YOUR_ZONE_ID,
                allow_overwrite=True,
                ttl=60)
    
    example_tls_subscription.apply(create_domain_validation)
    # Blocks until the certificate has been issued. Its certificate_id attribute
    # is only known after issuance, so downstream resources referencing it are
    # guaranteed to run with a valid certificate — all in a single apply.
    example_tls_subscription_validation: dict[str, fastly.TlsSubscriptionValidation] = {}
    for example_tls_subscription_validation_range in [{"key": k, "value": v} for [k, v] in sorted((certificates).items())]:
        example_tls_subscription_validation[example_tls_subscription_validation_range['key']] = fastly.TlsSubscriptionValidation(f"example-{example_tls_subscription_validation_range['key']}", subscription_id=example_tls_subscription[example_tls_subscription_validation_range["key"]].id,
        opts = pulumi.ResourceOptions(depends_on=[domain_validation]))
    # The activation was created automatically by Fastly when the certificate was
    # issued; this data source reads it (e.g. to consume dns_records/IDs).
    example = {__key: fastly.get_tls_activation(domain=__value["commonName"]) for __key, __value in sorted(certificates.items())}
    pulumi.export("certificateIds", {k: v.certificate_id for k, v in sorted(example_tls_subscription_validation.items())})
    
    Example coming soon!
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    using Fastly = Pulumi.Fastly;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var certificates = config.RequireObject<Dictionary<string, Certificates>>("certificates");
        var defaultTls = Fastly.GetTlsConfiguration.Invoke(new()
        {
            Default = true,
        });
    
        var exampleTlsSubscription = new List<Fastly.TlsSubscription>();
        foreach (var range in certificates.Select(pair => new { pair.Key, pair.Value }))
        {
            exampleTlsSubscription.Add(new Fastly.TlsSubscription($"example-{range.Key}", new()
            {
                CertificateAuthority = range.Value.Authority,
                CommonName = range.Value.CommonName,
                Domains = range.Value.Domains,
                ForceDestroy = range.Value.ForceDestroy,
                ConfigurationId = defaultTls.Apply(getTlsConfigurationResult => getTlsConfigurationResult.Id),
            }));
        }
        // The domain validation challenge records MUST be created before validation
        // can succeed. This example uses DNS-based validation: replace with your DNS
        // provider's record resource, fed from
        // fastly_tls_subscription.example[each.key].managed_dns_challenges
        // (see the fastly_tls_subscription documentation for a Route53 example).
        var domainValidation = new List<Aws.Route53Record>();
        exampleTlsSubscription.Apply(rangeBody =>
        {
            foreach (var range in rangeBody.Select(pair => new { pair.Key, pair.Value }))
            {
                domainValidation.Add(new Aws.Route53Record($"domain_validation-{range.Key}", new()
                {
                    Name = range.Value.ManagedDnsChallenges[0].RecordName,
                    Type = range.Value.ManagedDnsChallenges[0].RecordType,
                    Records = new[]
                    {
                        range.Value.ManagedDnsChallenges[0].RecordValue,
                    },
                    ZoneId = "REPLACE_WITH_YOUR_ZONE_ID",
                    AllowOverwrite = true,
                    Ttl = 60,
                }));
            }
            return 0;
        });
        // Blocks until the certificate has been issued. Its certificate_id attribute
        // is only known after issuance, so downstream resources referencing it are
        // guaranteed to run with a valid certificate — all in a single apply.
        var exampleTlsSubscriptionValidation = new List<Fastly.TlsSubscriptionValidation>();
        foreach (var range in certificates.Select(pair => new { pair.Key, pair.Value }))
        {
            exampleTlsSubscriptionValidation.Add(new Fastly.TlsSubscriptionValidation($"example-{range.Key}", new()
            {
                SubscriptionId = exampleTlsSubscription[range.Key].Id,
            }, new CustomResourceOptions
            {
                DependsOn =
                {
                    domainValidation,
                },
            }));
        }
        // The activation was created automatically by Fastly when the certificate was
        // issued; this data source reads it (e.g. to consume dns_records/IDs).
        var example = certificates.Select(pair => new { pair.Key, pair.Value }).ToDictionary(item => {
            var __key = item.Key;
            return __key;
        }, item => {
            var __value = item.Value;
            return Fastly.GetTlsActivation.Invoke(new()
            {
                Domain = __value.CommonName,
            });
        });
    
        return new Dictionary<string, object?>
        {
            ["certificateIds"] = exampleTlsSubscriptionValidation.Select(pair => new { pair.Key, pair.Value }).ToDictionary(item => {
                var k = item.Key;
                return k;
            }, item => {
                var v = item.Value;
                return v.CertificateId;
            }),
        };
    });
    
    public class Certificates
    {
        public string authority { get; set; }
        public string commonName { get; set; }
        public List<string> domains { get; set; }
        public bool forceDestroy { get; set; }
    }
    
    Example coming soon!
    
    Example coming soon!
    
    pulumi {
      required_providers {
        aws = {
          source = "pulumi/aws"
        }
        fastly = {
          source = "pulumi/fastly"
        }
      }
    }
    
    data "fastly_gettlsconfiguration" "defaultTls" {
      default = true
    }
    data "fastly_gettlsactivation" "invoke_1" {
      for_each = var.certificates
      domain   = each.value.commonName
    }
    
    resource "fastly_tlssubscription" "example" {
      for_each              = var.certificates
      certificate_authority = each.value.authority
      common_name           = each.value.commonName
      domains               = each.value.domains
      force_destroy         = each.value.forceDestroy
      configuration_id      = data.fastly_gettlsconfiguration.defaultTls.id
    }
    # The domain validation challenge records MUST be created before validation
    # can succeed. This example uses DNS-based validation: replace with your DNS
    # provider's record resource, fed from
    # fastly_tls_subscription.example[each.key].managed_dns_challenges
    # (see the fastly_tls_subscription documentation for a Route53 example).
    resource "aws_route53record" "domain_validation" {
      for_each        = fastly_tlssubscription.example
      name            = each.value.managedDnsChallenges[0].recordName
      type            = each.value.managedDnsChallenges[0].recordType
      records         = [each.value.managedDnsChallenges[0].recordValue]
      zone_id         = "REPLACE_WITH_YOUR_ZONE_ID"
      allow_overwrite = true
      ttl             = 60
    }
    # Blocks until the certificate has been issued. Its certificate_id attribute
    # is only known after issuance, so downstream resources referencing it are
    # guaranteed to run with a valid certificate — all in a single apply.
    resource "fastly_tlssubscriptionvalidation" "example" {
      for_each        = var.certificates
      depends_on      = [aws_route53record.domain_validation]
      subscription_id = fastly_tlssubscription.example[each.key].id
    }
    # Certificates map: key = domain (common_name), value = subscription config
    variable "certificates" {
      type = map(object({authority=string, commonName=string, domains=list(string), forceDestroy=bool}))
    }
    # The activation was created automatically by Fastly when the certificate was
    # issued; this data source reads it (e.g. to consume dns_records/IDs).
    locals {
      example = {for __key, __value in var.certificates : __key => data.fastly_gettlsactivation.invoke_1[__key]}
    }
    output "certificateIds" {
      value = {for k, v in fastly_tlssubscriptionvalidation.example : k => v.certificateId}
    }
    

    Create TlsSubscriptionValidation Resource

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

    Constructor syntax

    new TlsSubscriptionValidation(name: string, args: TlsSubscriptionValidationArgs, opts?: CustomResourceOptions);
    @overload
    def TlsSubscriptionValidation(resource_name: str,
                                  args: TlsSubscriptionValidationArgs,
                                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def TlsSubscriptionValidation(resource_name: str,
                                  opts: Optional[ResourceOptions] = None,
                                  subscription_id: Optional[str] = None)
    func NewTlsSubscriptionValidation(ctx *Context, name string, args TlsSubscriptionValidationArgs, opts ...ResourceOption) (*TlsSubscriptionValidation, error)
    public TlsSubscriptionValidation(string name, TlsSubscriptionValidationArgs args, CustomResourceOptions? opts = null)
    public TlsSubscriptionValidation(String name, TlsSubscriptionValidationArgs args)
    public TlsSubscriptionValidation(String name, TlsSubscriptionValidationArgs args, CustomResourceOptions options)
    
    type: fastly:TlsSubscriptionValidation
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "fastly_tls_subscription_validation" "name" {
        # resource properties
    }

    Parameters

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

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var tlsSubscriptionValidationResource = new Fastly.TlsSubscriptionValidation("tlsSubscriptionValidationResource", new()
    {
        SubscriptionId = "string",
    });
    
    example, err := fastly.NewTlsSubscriptionValidation(ctx, "tlsSubscriptionValidationResource", &fastly.TlsSubscriptionValidationArgs{
    	SubscriptionId: pulumi.String("string"),
    })
    
    resource "fastly_tls_subscription_validation" "tlsSubscriptionValidationResource" {
      lifecycle {
        create_before_destroy = true
      }
      subscription_id = "string"
    }
    
    var tlsSubscriptionValidationResource = new TlsSubscriptionValidation("tlsSubscriptionValidationResource", TlsSubscriptionValidationArgs.builder()
        .subscriptionId("string")
        .build());
    
    tls_subscription_validation_resource = fastly.TlsSubscriptionValidation("tlsSubscriptionValidationResource", subscription_id="string")
    
    const tlsSubscriptionValidationResource = new fastly.TlsSubscriptionValidation("tlsSubscriptionValidationResource", {subscriptionId: "string"});
    
    type: fastly:TlsSubscriptionValidation
    properties:
        subscriptionId: string
    

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

    SubscriptionId string
    The ID of the TLS Subscription that should be validated.
    SubscriptionId string
    The ID of the TLS Subscription that should be validated.
    subscription_id string
    The ID of the TLS Subscription that should be validated.
    subscriptionId String
    The ID of the TLS Subscription that should be validated.
    subscriptionId string
    The ID of the TLS Subscription that should be validated.
    subscription_id str
    The ID of the TLS Subscription that should be validated.
    subscriptionId String
    The ID of the TLS Subscription that should be validated.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the TlsSubscriptionValidation resource produces the following output properties:

    CertificateId string
    The ID of the certificate issued for the validated subscription. Only populated once the subscription reaches the issued state. Reference this from fastly_tls_activation.certificate_id to guarantee the activation is created after the certificate exists, within a single apply.
    Id string
    The provider-assigned unique ID for this managed resource.
    CertificateId string
    The ID of the certificate issued for the validated subscription. Only populated once the subscription reaches the issued state. Reference this from fastly_tls_activation.certificate_id to guarantee the activation is created after the certificate exists, within a single apply.
    Id string
    The provider-assigned unique ID for this managed resource.
    certificate_id string
    The ID of the certificate issued for the validated subscription. Only populated once the subscription reaches the issued state. Reference this from fastly_tls_activation.certificate_id to guarantee the activation is created after the certificate exists, within a single apply.
    id string
    The provider-assigned unique ID for this managed resource.
    certificateId String
    The ID of the certificate issued for the validated subscription. Only populated once the subscription reaches the issued state. Reference this from fastly_tls_activation.certificate_id to guarantee the activation is created after the certificate exists, within a single apply.
    id String
    The provider-assigned unique ID for this managed resource.
    certificateId string
    The ID of the certificate issued for the validated subscription. Only populated once the subscription reaches the issued state. Reference this from fastly_tls_activation.certificate_id to guarantee the activation is created after the certificate exists, within a single apply.
    id string
    The provider-assigned unique ID for this managed resource.
    certificate_id str
    The ID of the certificate issued for the validated subscription. Only populated once the subscription reaches the issued state. Reference this from fastly_tls_activation.certificate_id to guarantee the activation is created after the certificate exists, within a single apply.
    id str
    The provider-assigned unique ID for this managed resource.
    certificateId String
    The ID of the certificate issued for the validated subscription. Only populated once the subscription reaches the issued state. Reference this from fastly_tls_activation.certificate_id to guarantee the activation is created after the certificate exists, within a single apply.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing TlsSubscriptionValidation Resource

    Get an existing TlsSubscriptionValidation 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?: TlsSubscriptionValidationState, opts?: CustomResourceOptions): TlsSubscriptionValidation
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            certificate_id: Optional[str] = None,
            subscription_id: Optional[str] = None) -> TlsSubscriptionValidation
    func GetTlsSubscriptionValidation(ctx *Context, name string, id IDInput, state *TlsSubscriptionValidationState, opts ...ResourceOption) (*TlsSubscriptionValidation, error)
    public static TlsSubscriptionValidation Get(string name, Input<string> id, TlsSubscriptionValidationState? state, CustomResourceOptions? opts = null)
    public static TlsSubscriptionValidation get(String name, Output<String> id, TlsSubscriptionValidationState state, CustomResourceOptions options)
    resources:  _:    type: fastly:TlsSubscriptionValidation    get:      id: ${id}
    import {
      to = fastly_tls_subscription_validation.example
      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:
    CertificateId string
    The ID of the certificate issued for the validated subscription. Only populated once the subscription reaches the issued state. Reference this from fastly_tls_activation.certificate_id to guarantee the activation is created after the certificate exists, within a single apply.
    SubscriptionId string
    The ID of the TLS Subscription that should be validated.
    CertificateId string
    The ID of the certificate issued for the validated subscription. Only populated once the subscription reaches the issued state. Reference this from fastly_tls_activation.certificate_id to guarantee the activation is created after the certificate exists, within a single apply.
    SubscriptionId string
    The ID of the TLS Subscription that should be validated.
    certificate_id string
    The ID of the certificate issued for the validated subscription. Only populated once the subscription reaches the issued state. Reference this from fastly_tls_activation.certificate_id to guarantee the activation is created after the certificate exists, within a single apply.
    subscription_id string
    The ID of the TLS Subscription that should be validated.
    certificateId String
    The ID of the certificate issued for the validated subscription. Only populated once the subscription reaches the issued state. Reference this from fastly_tls_activation.certificate_id to guarantee the activation is created after the certificate exists, within a single apply.
    subscriptionId String
    The ID of the TLS Subscription that should be validated.
    certificateId string
    The ID of the certificate issued for the validated subscription. Only populated once the subscription reaches the issued state. Reference this from fastly_tls_activation.certificate_id to guarantee the activation is created after the certificate exists, within a single apply.
    subscriptionId string
    The ID of the TLS Subscription that should be validated.
    certificate_id str
    The ID of the certificate issued for the validated subscription. Only populated once the subscription reaches the issued state. Reference this from fastly_tls_activation.certificate_id to guarantee the activation is created after the certificate exists, within a single apply.
    subscription_id str
    The ID of the TLS Subscription that should be validated.
    certificateId String
    The ID of the certificate issued for the validated subscription. Only populated once the subscription reaches the issued state. Reference this from fastly_tls_activation.certificate_id to guarantee the activation is created after the certificate exists, within a single apply.
    subscriptionId String
    The ID of the TLS Subscription that should be validated.

    Package Details

    Repository
    Fastly pulumi/pulumi-fastly
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the fastly Terraform Provider.
    fastly logo
    Viewing docs for Fastly v12.6.0
    published on Wednesday, Aug 12, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial