1. Packages
  2. Tls Provider
TLS v5.0.9 published on Wednesday, Oct 16, 2024 by Pulumi

Tls Provider

tls logo
TLS v5.0.9 published on Wednesday, Oct 16, 2024 by Pulumi

    Installation

    The tls provider is available as a package in all Pulumi languages:

    Overview

    The TLS provider provides utilities for working with Transport Layer Security keys and certificates. It provides resources that allow private keys, certificates and certificate requests to be created as part of a Pulumi deployment.

    Another name for Transport Layer Security is Secure Sockets Layer, or SSL. TLS and SSL are equivalent when considering the resources managed by this provider.

    This provider is not particularly useful on its own, but it can be used to create certificates and credentials that can then be used with other providers when creating resources that expose TLS services or that themselves provision TLS certificates.

    Use the navigation to the left to read about the available resources.

    Example Usage

    Example currently unavailable in this language
    
    Example currently unavailable in this language
    
    Example currently unavailable in this language
    
    Example currently unavailable in this language
    
    resources:
      # This example creates a self-signed certificate,
      # and uses it to create an AWS IAM Server certificate.
      #
      # THIS IS NOT RECOMMENDED FOR PRODUCTION SERVICES.
      # See the detailed documentation of each resource for further
      # security considerations and other practical tradeoffs.
      example:
        type: tls:PrivateKey
        properties:
          algorithm: ECDSA
      exampleSelfSignedCert:
        type: tls:SelfSignedCert
        name: example
        properties:
          keyAlgorithm: ${example.algorithm}
          privateKeyPem: ${example.privateKeyPem}
          validityPeriodHours: 12 # Generate a new certificate if Pulumi is run within three
          #   # hours of the certificate's expiration time.
          earlyRenewalHours: 3 # Reasonable set of uses for a server SSL certificate.
          allowedUses:
            - key_encipherment
            - digital_signature
            - server_auth
          dnsNames:
            - example.com
            - example.net
          subject:
            commonName: example.com
            organization: ACME Examples, Inc
      # For example, this can be used to populate an AWS IAM server certificate.
      exampleServerCertificate:
        type: aws:iam:ServerCertificate
        name: example
        properties:
          name: example_self_signed_cert
          certificateBody: ${exampleSelfSignedCert.certPem}
          privateKey: ${example.privateKeyPem}
    
    Example currently unavailable in this language
    

    Configuring Proxy

    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: nodejs
    
    import * as pulumi from "@pulumi/pulumi";
    import * as tls from "@pulumi/tls";
    
    const test = tls.getCertificate({
        url: "https://example.com",
    });
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: python
    
    import pulumi
    import pulumi_tls as tls
    
    test = tls.get_certificate(url="https://example.com")
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: dotnet
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tls = Pulumi.Tls;
    
    return await Deployment.RunAsync(() =>
    {
        var test = Tls.GetCertificate.Invoke(new()
        {
            Url = "https://example.com",
        });
    
    });
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: go
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-tls/sdk/v5/go/tls"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := tls.GetCertificate(ctx, &tls.GetCertificateArgs{
    			Url: pulumi.StringRef("https://example.com"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: yaml
    
    variables:
      test:
        fn::invoke:
          Function: tls:getCertificate
          Arguments:
            url: https://example.com
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: java
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tls.TlsFunctions;
    import com.pulumi.tls.inputs.GetCertificateArgs;
    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) {
            final var test = TlsFunctions.getCertificate(GetCertificateArgs.builder()
                .url("https://example.com")
                .build());
    
        }
    }
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: nodejs
    
    import * as pulumi from "@pulumi/pulumi";
    import * as tls from "@pulumi/tls";
    
    const test = tls.getCertificate({
        url: "https://example.com",
    });
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: python
    
    import pulumi
    import pulumi_tls as tls
    
    test = tls.get_certificate(url="https://example.com")
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: dotnet
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tls = Pulumi.Tls;
    
    return await Deployment.RunAsync(() =>
    {
        var test = Tls.GetCertificate.Invoke(new()
        {
            Url = "https://example.com",
        });
    
    });
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: go
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-tls/sdk/v5/go/tls"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := tls.GetCertificate(ctx, &tls.GetCertificateArgs{
    			Url: pulumi.StringRef("https://example.com"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: yaml
    
    variables:
      test:
        fn::invoke:
          Function: tls:getCertificate
          Arguments:
            url: https://example.com
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: java
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tls.TlsFunctions;
    import com.pulumi.tls.inputs.GetCertificateArgs;
    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) {
            final var test = TlsFunctions.getCertificate(GetCertificateArgs.builder()
                .url("https://example.com")
                .build());
    
        }
    }
    

    Configuration Reference

    • proxy (Block List) Proxy used by resources and functions that connect to external endpoints. (see below for nested schema)

    Nested Configuration Reference for proxy

    Optional:

    • fromEnv (Boolean) When true the provider will discover the proxy configuration from environment variables. This is based upon http.ProxyFromEnvironment and it supports the same environment variables (default: true).
    • password (String, Sensitive) Password used for Basic authentication against the Proxy.
    • url (String) URL used to connect to the Proxy. Accepted schemes are: http, https, socks5.
    • username (String) Username (or Token) used for Basic authentication against the Proxy.

    Limitations

    ECDSA with P224 elliptic curve

    When using ECDSA with P224, all the (computed) attributes that have to do with OpenSSH will have a value of "" (empty string). This applies to different resources and functions offered by this provider, like the tls.PrivateKey resource or the tls.getPublicKey function.

    The attributes affected are:

    • .public_key_openssh
    • .private_key_openssh
    • .public_key_fingerprint_md5
    • .public_key_fingerprint_sha256

    This is because the SSH ECC Algorithm Integration (RFC 5656) restricts support for elliptic curves to “nistp256”, “nistp384” and “nistp521”.

    tls logo
    TLS v5.0.9 published on Wednesday, Oct 16, 2024 by Pulumi