1. Packages
  2. Fastly
  3. API Docs
  4. TlsActivation
Fastly v8.5.1 published on Monday, Mar 18, 2024 by Pulumi

fastly.TlsActivation

Explore with Pulumi AI

fastly logo
Fastly v8.5.1 published on Monday, Mar 18, 2024 by Pulumi

    Enables TLS on a domain using a specified custom TLS certificate.

    Note: The Fastly service must be provisioned prior to enabling TLS on it. This can be achieved in Pulumi using depends_on.

    Example Usage

    Basic usage:

    import * as pulumi from "@pulumi/pulumi";
    import * as fastly from "@pulumi/fastly";
    
    const demoServiceVcl = new fastly.ServiceVcl("demoServiceVcl", {
        domains: [{
            name: "example.com",
        }],
        backends: [{
            address: "127.0.0.1",
            name: "localhost",
        }],
        forceDestroy: true,
    });
    const demoTlsPrivateKey = new fastly.TlsPrivateKey("demoTlsPrivateKey", {keyPem: "..."});
    const demoTlsCertificate = new fastly.TlsCertificate("demoTlsCertificate", {certificateBody: "..."}, {
        dependsOn: [demoTlsPrivateKey],
    });
    const test = new fastly.TlsActivation("test", {
        certificateId: demoTlsCertificate.id,
        domain: "example.com",
    }, {
        dependsOn: [demoServiceVcl],
    });
    
    import pulumi
    import pulumi_fastly as fastly
    
    demo_service_vcl = fastly.ServiceVcl("demoServiceVcl",
        domains=[fastly.ServiceVclDomainArgs(
            name="example.com",
        )],
        backends=[fastly.ServiceVclBackendArgs(
            address="127.0.0.1",
            name="localhost",
        )],
        force_destroy=True)
    demo_tls_private_key = fastly.TlsPrivateKey("demoTlsPrivateKey", key_pem="...")
    demo_tls_certificate = fastly.TlsCertificate("demoTlsCertificate", certificate_body="...",
    opts=pulumi.ResourceOptions(depends_on=[demo_tls_private_key]))
    test = fastly.TlsActivation("test",
        certificate_id=demo_tls_certificate.id,
        domain="example.com",
        opts=pulumi.ResourceOptions(depends_on=[demo_service_vcl]))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-fastly/sdk/v8/go/fastly"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		demoServiceVcl, err := fastly.NewServiceVcl(ctx, "demoServiceVcl", &fastly.ServiceVclArgs{
    			Domains: fastly.ServiceVclDomainArray{
    				&fastly.ServiceVclDomainArgs{
    					Name: pulumi.String("example.com"),
    				},
    			},
    			Backends: fastly.ServiceVclBackendArray{
    				&fastly.ServiceVclBackendArgs{
    					Address: pulumi.String("127.0.0.1"),
    					Name:    pulumi.String("localhost"),
    				},
    			},
    			ForceDestroy: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		demoTlsPrivateKey, err := fastly.NewTlsPrivateKey(ctx, "demoTlsPrivateKey", &fastly.TlsPrivateKeyArgs{
    			KeyPem: pulumi.String("..."),
    		})
    		if err != nil {
    			return err
    		}
    		demoTlsCertificate, err := fastly.NewTlsCertificate(ctx, "demoTlsCertificate", &fastly.TlsCertificateArgs{
    			CertificateBody: pulumi.String("..."),
    		}, pulumi.DependsOn([]pulumi.Resource{
    			demoTlsPrivateKey,
    		}))
    		if err != nil {
    			return err
    		}
    		_, err = fastly.NewTlsActivation(ctx, "test", &fastly.TlsActivationArgs{
    			CertificateId: demoTlsCertificate.ID(),
    			Domain:        pulumi.String("example.com"),
    		}, pulumi.DependsOn([]pulumi.Resource{
    			demoServiceVcl,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Fastly = Pulumi.Fastly;
    
    return await Deployment.RunAsync(() => 
    {
        var demoServiceVcl = new Fastly.ServiceVcl("demoServiceVcl", new()
        {
            Domains = new[]
            {
                new Fastly.Inputs.ServiceVclDomainArgs
                {
                    Name = "example.com",
                },
            },
            Backends = new[]
            {
                new Fastly.Inputs.ServiceVclBackendArgs
                {
                    Address = "127.0.0.1",
                    Name = "localhost",
                },
            },
            ForceDestroy = true,
        });
    
        var demoTlsPrivateKey = new Fastly.TlsPrivateKey("demoTlsPrivateKey", new()
        {
            KeyPem = "...",
        });
    
        var demoTlsCertificate = new Fastly.TlsCertificate("demoTlsCertificate", new()
        {
            CertificateBody = "...",
        }, new CustomResourceOptions
        {
            DependsOn = new[]
            {
                demoTlsPrivateKey,
            },
        });
    
        var test = new Fastly.TlsActivation("test", new()
        {
            CertificateId = demoTlsCertificate.Id,
            Domain = "example.com",
        }, new CustomResourceOptions
        {
            DependsOn = new[]
            {
                demoServiceVcl,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.fastly.ServiceVcl;
    import com.pulumi.fastly.ServiceVclArgs;
    import com.pulumi.fastly.inputs.ServiceVclDomainArgs;
    import com.pulumi.fastly.inputs.ServiceVclBackendArgs;
    import com.pulumi.fastly.TlsPrivateKey;
    import com.pulumi.fastly.TlsPrivateKeyArgs;
    import com.pulumi.fastly.TlsCertificate;
    import com.pulumi.fastly.TlsCertificateArgs;
    import com.pulumi.fastly.TlsActivation;
    import com.pulumi.fastly.TlsActivationArgs;
    import com.pulumi.resources.CustomResourceOptions;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var demoServiceVcl = new ServiceVcl("demoServiceVcl", ServiceVclArgs.builder()        
                .domains(ServiceVclDomainArgs.builder()
                    .name("example.com")
                    .build())
                .backends(ServiceVclBackendArgs.builder()
                    .address("127.0.0.1")
                    .name("localhost")
                    .build())
                .forceDestroy(true)
                .build());
    
            var demoTlsPrivateKey = new TlsPrivateKey("demoTlsPrivateKey", TlsPrivateKeyArgs.builder()        
                .keyPem("...")
                .build());
    
            var demoTlsCertificate = new TlsCertificate("demoTlsCertificate", TlsCertificateArgs.builder()        
                .certificateBody("...")
                .build(), CustomResourceOptions.builder()
                    .dependsOn(demoTlsPrivateKey)
                    .build());
    
            var test = new TlsActivation("test", TlsActivationArgs.builder()        
                .certificateId(demoTlsCertificate.id())
                .domain("example.com")
                .build(), CustomResourceOptions.builder()
                    .dependsOn(demoServiceVcl)
                    .build());
    
        }
    }
    
    resources:
      demoServiceVcl:
        type: fastly:ServiceVcl
        properties:
          domains:
            - name: example.com
          backends:
            - address: 127.0.0.1
              name: localhost
          forceDestroy: true
      demoTlsPrivateKey:
        type: fastly:TlsPrivateKey
        properties:
          keyPem: '...'
      demoTlsCertificate:
        type: fastly:TlsCertificate
        properties:
          certificateBody: '...'
        options:
          dependson:
            - ${demoTlsPrivateKey}
      test:
        type: fastly:TlsActivation
        properties:
          certificateId: ${demoTlsCertificate.id}
          domain: example.com
        options:
          dependson:
            - ${demoServiceVcl}
    

    Warning: Updating the fastly.TlsPrivateKey/fastly.TlsCertificate resources should be done in multiple plan/apply steps to avoid potential downtime. The new certificate and associated private key must first be created so they exist alongside the currently active resources. Once the new resources have been created, then the fastly.TlsActivation can be updated to point to the new certificate. Finally, the original key/certificate resources can be deleted.

    Create TlsActivation Resource

    new TlsActivation(name: string, args: TlsActivationArgs, opts?: CustomResourceOptions);
    @overload
    def TlsActivation(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      certificate_id: Optional[str] = None,
                      configuration_id: Optional[str] = None,
                      domain: Optional[str] = None,
                      mutual_authentication_id: Optional[str] = None)
    @overload
    def TlsActivation(resource_name: str,
                      args: TlsActivationArgs,
                      opts: Optional[ResourceOptions] = None)
    func NewTlsActivation(ctx *Context, name string, args TlsActivationArgs, opts ...ResourceOption) (*TlsActivation, error)
    public TlsActivation(string name, TlsActivationArgs args, CustomResourceOptions? opts = null)
    public TlsActivation(String name, TlsActivationArgs args)
    public TlsActivation(String name, TlsActivationArgs args, CustomResourceOptions options)
    
    type: fastly:TlsActivation
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args TlsActivationArgs
    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 TlsActivationArgs
    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 TlsActivationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args TlsActivationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args TlsActivationArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    CertificateId string
    ID of certificate to use. Must have the domain specified in the certificate's Subject Alternative Names.
    Domain string
    Domain to enable TLS on. Must be assigned to an existing Fastly Service.
    ConfigurationId string
    ID of TLS configuration to be used to terminate TLS traffic, or use the default one if missing.
    MutualAuthenticationId string
    An alphanumeric string identifying a mutual authentication.
    CertificateId string
    ID of certificate to use. Must have the domain specified in the certificate's Subject Alternative Names.
    Domain string
    Domain to enable TLS on. Must be assigned to an existing Fastly Service.
    ConfigurationId string
    ID of TLS configuration to be used to terminate TLS traffic, or use the default one if missing.
    MutualAuthenticationId string
    An alphanumeric string identifying a mutual authentication.
    certificateId String
    ID of certificate to use. Must have the domain specified in the certificate's Subject Alternative Names.
    domain String
    Domain to enable TLS on. Must be assigned to an existing Fastly Service.
    configurationId String
    ID of TLS configuration to be used to terminate TLS traffic, or use the default one if missing.
    mutualAuthenticationId String
    An alphanumeric string identifying a mutual authentication.
    certificateId string
    ID of certificate to use. Must have the domain specified in the certificate's Subject Alternative Names.
    domain string
    Domain to enable TLS on. Must be assigned to an existing Fastly Service.
    configurationId string
    ID of TLS configuration to be used to terminate TLS traffic, or use the default one if missing.
    mutualAuthenticationId string
    An alphanumeric string identifying a mutual authentication.
    certificate_id str
    ID of certificate to use. Must have the domain specified in the certificate's Subject Alternative Names.
    domain str
    Domain to enable TLS on. Must be assigned to an existing Fastly Service.
    configuration_id str
    ID of TLS configuration to be used to terminate TLS traffic, or use the default one if missing.
    mutual_authentication_id str
    An alphanumeric string identifying a mutual authentication.
    certificateId String
    ID of certificate to use. Must have the domain specified in the certificate's Subject Alternative Names.
    domain String
    Domain to enable TLS on. Must be assigned to an existing Fastly Service.
    configurationId String
    ID of TLS configuration to be used to terminate TLS traffic, or use the default one if missing.
    mutualAuthenticationId String
    An alphanumeric string identifying a mutual authentication.

    Outputs

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

    CreatedAt string
    Time-stamp (GMT) when TLS was enabled.
    Id string
    The provider-assigned unique ID for this managed resource.
    CreatedAt string
    Time-stamp (GMT) when TLS was enabled.
    Id string
    The provider-assigned unique ID for this managed resource.
    createdAt String
    Time-stamp (GMT) when TLS was enabled.
    id String
    The provider-assigned unique ID for this managed resource.
    createdAt string
    Time-stamp (GMT) when TLS was enabled.
    id string
    The provider-assigned unique ID for this managed resource.
    created_at str
    Time-stamp (GMT) when TLS was enabled.
    id str
    The provider-assigned unique ID for this managed resource.
    createdAt String
    Time-stamp (GMT) when TLS was enabled.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing TlsActivation Resource

    Get an existing TlsActivation 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?: TlsActivationState, opts?: CustomResourceOptions): TlsActivation
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            certificate_id: Optional[str] = None,
            configuration_id: Optional[str] = None,
            created_at: Optional[str] = None,
            domain: Optional[str] = None,
            mutual_authentication_id: Optional[str] = None) -> TlsActivation
    func GetTlsActivation(ctx *Context, name string, id IDInput, state *TlsActivationState, opts ...ResourceOption) (*TlsActivation, error)
    public static TlsActivation Get(string name, Input<string> id, TlsActivationState? state, CustomResourceOptions? opts = null)
    public static TlsActivation get(String name, Output<String> id, TlsActivationState 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:
    CertificateId string
    ID of certificate to use. Must have the domain specified in the certificate's Subject Alternative Names.
    ConfigurationId string
    ID of TLS configuration to be used to terminate TLS traffic, or use the default one if missing.
    CreatedAt string
    Time-stamp (GMT) when TLS was enabled.
    Domain string
    Domain to enable TLS on. Must be assigned to an existing Fastly Service.
    MutualAuthenticationId string
    An alphanumeric string identifying a mutual authentication.
    CertificateId string
    ID of certificate to use. Must have the domain specified in the certificate's Subject Alternative Names.
    ConfigurationId string
    ID of TLS configuration to be used to terminate TLS traffic, or use the default one if missing.
    CreatedAt string
    Time-stamp (GMT) when TLS was enabled.
    Domain string
    Domain to enable TLS on. Must be assigned to an existing Fastly Service.
    MutualAuthenticationId string
    An alphanumeric string identifying a mutual authentication.
    certificateId String
    ID of certificate to use. Must have the domain specified in the certificate's Subject Alternative Names.
    configurationId String
    ID of TLS configuration to be used to terminate TLS traffic, or use the default one if missing.
    createdAt String
    Time-stamp (GMT) when TLS was enabled.
    domain String
    Domain to enable TLS on. Must be assigned to an existing Fastly Service.
    mutualAuthenticationId String
    An alphanumeric string identifying a mutual authentication.
    certificateId string
    ID of certificate to use. Must have the domain specified in the certificate's Subject Alternative Names.
    configurationId string
    ID of TLS configuration to be used to terminate TLS traffic, or use the default one if missing.
    createdAt string
    Time-stamp (GMT) when TLS was enabled.
    domain string
    Domain to enable TLS on. Must be assigned to an existing Fastly Service.
    mutualAuthenticationId string
    An alphanumeric string identifying a mutual authentication.
    certificate_id str
    ID of certificate to use. Must have the domain specified in the certificate's Subject Alternative Names.
    configuration_id str
    ID of TLS configuration to be used to terminate TLS traffic, or use the default one if missing.
    created_at str
    Time-stamp (GMT) when TLS was enabled.
    domain str
    Domain to enable TLS on. Must be assigned to an existing Fastly Service.
    mutual_authentication_id str
    An alphanumeric string identifying a mutual authentication.
    certificateId String
    ID of certificate to use. Must have the domain specified in the certificate's Subject Alternative Names.
    configurationId String
    ID of TLS configuration to be used to terminate TLS traffic, or use the default one if missing.
    createdAt String
    Time-stamp (GMT) when TLS was enabled.
    domain String
    Domain to enable TLS on. Must be assigned to an existing Fastly Service.
    mutualAuthenticationId String
    An alphanumeric string identifying a mutual authentication.

    Import

    A TLS activation can be imported using its ID, e.g.

    $ pulumi import fastly:index/tlsActivation:TlsActivation demo xxxxxxxx
    

    Package Details

    Repository
    Fastly pulumi/pulumi-fastly
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the fastly Terraform Provider.
    fastly logo
    Fastly v8.5.1 published on Monday, Mar 18, 2024 by Pulumi