1. Packages
  2. Fastly Provider
  3. API Docs
  4. TlsActivation
Fastly v8.13.0 published on Wednesday, Nov 13, 2024 by Pulumi

fastly.TlsActivation

Explore with Pulumi AI

fastly logo
Fastly v8.13.0 published on Wednesday, Nov 13, 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 demo = new fastly.ServiceVcl("demo", {
        name: "my-service",
        domains: [{
            name: "example.com",
        }],
        backends: [{
            address: "127.0.0.1",
            name: "localhost",
        }],
        forceDestroy: true,
    });
    const demoTlsPrivateKey = new fastly.TlsPrivateKey("demo", {
        keyPem: "...",
        name: "demo-key",
    });
    const demoTlsCertificate = new fastly.TlsCertificate("demo", {
        certificateBody: "...",
        name: "demo-cert",
    }, {
        dependsOn: [demoTlsPrivateKey],
    });
    const test = new fastly.TlsActivation("test", {
        certificateId: demoTlsCertificate.id,
        domain: "example.com",
    }, {
        dependsOn: [demo],
    });
    
    import pulumi
    import pulumi_fastly as fastly
    
    demo = fastly.ServiceVcl("demo",
        name="my-service",
        domains=[{
            "name": "example.com",
        }],
        backends=[{
            "address": "127.0.0.1",
            "name": "localhost",
        }],
        force_destroy=True)
    demo_tls_private_key = fastly.TlsPrivateKey("demo",
        key_pem="...",
        name="demo-key")
    demo_tls_certificate = fastly.TlsCertificate("demo",
        certificate_body="...",
        name="demo-cert",
        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]))
    
    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 {
    		demo, err := fastly.NewServiceVcl(ctx, "demo", &fastly.ServiceVclArgs{
    			Name: pulumi.String("my-service"),
    			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, "demo", &fastly.TlsPrivateKeyArgs{
    			KeyPem: pulumi.String("..."),
    			Name:   pulumi.String("demo-key"),
    		})
    		if err != nil {
    			return err
    		}
    		demoTlsCertificate, err := fastly.NewTlsCertificate(ctx, "demo", &fastly.TlsCertificateArgs{
    			CertificateBody: pulumi.String("..."),
    			Name:            pulumi.String("demo-cert"),
    		}, 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{
    			demo,
    		}))
    		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 demo = new Fastly.ServiceVcl("demo", new()
        {
            Name = "my-service",
            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("demo", new()
        {
            KeyPem = "...",
            Name = "demo-key",
        });
    
        var demoTlsCertificate = new Fastly.TlsCertificate("demo", new()
        {
            CertificateBody = "...",
            Name = "demo-cert",
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                demoTlsPrivateKey,
            },
        });
    
        var test = new Fastly.TlsActivation("test", new()
        {
            CertificateId = demoTlsCertificate.Id,
            Domain = "example.com",
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                demo,
            },
        });
    
    });
    
    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 demo = new ServiceVcl("demo", ServiceVclArgs.builder()
                .name("my-service")
                .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("...")
                .name("demo-key")
                .build());
    
            var demoTlsCertificate = new TlsCertificate("demoTlsCertificate", TlsCertificateArgs.builder()
                .certificateBody("...")
                .name("demo-cert")
                .build(), CustomResourceOptions.builder()
                    .dependsOn(demoTlsPrivateKey)
                    .build());
    
            var test = new TlsActivation("test", TlsActivationArgs.builder()
                .certificateId(demoTlsCertificate.id())
                .domain("example.com")
                .build(), CustomResourceOptions.builder()
                    .dependsOn(demo)
                    .build());
    
        }
    }
    
    resources:
      demo:
        type: fastly:ServiceVcl
        properties:
          name: my-service
          domains:
            - name: example.com
          backends:
            - address: 127.0.0.1
              name: localhost
          forceDestroy: true
      demoTlsPrivateKey:
        type: fastly:TlsPrivateKey
        name: demo
        properties:
          keyPem: '...'
          name: demo-key
      demoTlsCertificate:
        type: fastly:TlsCertificate
        name: demo
        properties:
          certificateBody: '...'
          name: demo-cert
        options:
          dependson:
            - ${demoTlsPrivateKey}
      test:
        type: fastly:TlsActivation
        properties:
          certificateId: ${demoTlsCertificate.id}
          domain: example.com
        options:
          dependson:
            - ${demo}
    

    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

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

    Constructor syntax

    new TlsActivation(name: string, args: TlsActivationArgs, opts?: CustomResourceOptions);
    @overload
    def TlsActivation(resource_name: str,
                      args: TlsActivationArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def TlsActivation(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      certificate_id: Optional[str] = None,
                      domain: Optional[str] = None,
                      configuration_id: Optional[str] = None,
                      mutual_authentication_id: Optional[str] = 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.
    
    

    Parameters

    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.

    Constructor example

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

    var tlsActivationResource = new Fastly.TlsActivation("tlsActivationResource", new()
    {
        CertificateId = "string",
        Domain = "string",
        ConfigurationId = "string",
        MutualAuthenticationId = "string",
    });
    
    example, err := fastly.NewTlsActivation(ctx, "tlsActivationResource", &fastly.TlsActivationArgs{
    	CertificateId:          pulumi.String("string"),
    	Domain:                 pulumi.String("string"),
    	ConfigurationId:        pulumi.String("string"),
    	MutualAuthenticationId: pulumi.String("string"),
    })
    
    var tlsActivationResource = new TlsActivation("tlsActivationResource", TlsActivationArgs.builder()
        .certificateId("string")
        .domain("string")
        .configurationId("string")
        .mutualAuthenticationId("string")
        .build());
    
    tls_activation_resource = fastly.TlsActivation("tlsActivationResource",
        certificate_id="string",
        domain="string",
        configuration_id="string",
        mutual_authentication_id="string")
    
    const tlsActivationResource = new fastly.TlsActivation("tlsActivationResource", {
        certificateId: "string",
        domain: "string",
        configurationId: "string",
        mutualAuthenticationId: "string",
    });
    
    type: fastly:TlsActivation
    properties:
        certificateId: string
        configurationId: string
        domain: string
        mutualAuthenticationId: string
    

    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

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    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
    

    To learn more about importing existing cloud resources, see Importing resources.

    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.13.0 published on Wednesday, Nov 13, 2024 by Pulumi