1. Packages
  2. Cloudflare
  3. API Docs
  4. AccessMutualTlsCertificate
Cloudflare v5.33.1 published on Wednesday, Jun 26, 2024 by Pulumi

cloudflare.AccessMutualTlsCertificate

Explore with Pulumi AI

cloudflare logo
Cloudflare v5.33.1 published on Wednesday, Jun 26, 2024 by Pulumi

    Provides a Cloudflare Access Mutual TLS Certificate resource. Mutual TLS authentication ensures that the traffic is secure and trusted in both directions between a client and server and can be used with Access to only allows requests from devices with a corresponding client certificate.

    It’s required that an account_id or zone_id is provided and in most cases using either is fine. However, if you’re using a scoped access token, you must provide the argument that matches the token’s scope. For example, an access token that is scoped to the “example.com” zone needs to use the zone_id argument.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as cloudflare from "@pulumi/cloudflare";
    
    const myCert = new cloudflare.AccessMutualTlsCertificate("my_cert", {
        zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
        name: "My Root Cert",
        certificate: caPem,
        associatedHostnames: ["staging.example.com"],
    });
    
    import pulumi
    import pulumi_cloudflare as cloudflare
    
    my_cert = cloudflare.AccessMutualTlsCertificate("my_cert",
        zone_id="0da42c8d2132a9ddaf714f9e7c920711",
        name="My Root Cert",
        certificate=ca_pem,
        associated_hostnames=["staging.example.com"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := cloudflare.NewAccessMutualTlsCertificate(ctx, "my_cert", &cloudflare.AccessMutualTlsCertificateArgs{
    			ZoneId:      pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
    			Name:        pulumi.String("My Root Cert"),
    			Certificate: pulumi.Any(caPem),
    			AssociatedHostnames: pulumi.StringArray{
    				pulumi.String("staging.example.com"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Cloudflare = Pulumi.Cloudflare;
    
    return await Deployment.RunAsync(() => 
    {
        var myCert = new Cloudflare.AccessMutualTlsCertificate("my_cert", new()
        {
            ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
            Name = "My Root Cert",
            Certificate = caPem,
            AssociatedHostnames = new[]
            {
                "staging.example.com",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.cloudflare.AccessMutualTlsCertificate;
    import com.pulumi.cloudflare.AccessMutualTlsCertificateArgs;
    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 myCert = new AccessMutualTlsCertificate("myCert", AccessMutualTlsCertificateArgs.builder()
                .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
                .name("My Root Cert")
                .certificate(caPem)
                .associatedHostnames("staging.example.com")
                .build());
    
        }
    }
    
    resources:
      myCert:
        type: cloudflare:AccessMutualTlsCertificate
        name: my_cert
        properties:
          zoneId: 0da42c8d2132a9ddaf714f9e7c920711
          name: My Root Cert
          certificate: ${caPem}
          associatedHostnames:
            - staging.example.com
    

    Create AccessMutualTlsCertificate Resource

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

    Constructor syntax

    new AccessMutualTlsCertificate(name: string, args: AccessMutualTlsCertificateArgs, opts?: CustomResourceOptions);
    @overload
    def AccessMutualTlsCertificate(resource_name: str,
                                   args: AccessMutualTlsCertificateArgs,
                                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def AccessMutualTlsCertificate(resource_name: str,
                                   opts: Optional[ResourceOptions] = None,
                                   name: Optional[str] = None,
                                   account_id: Optional[str] = None,
                                   associated_hostnames: Optional[Sequence[str]] = None,
                                   certificate: Optional[str] = None,
                                   zone_id: Optional[str] = None)
    func NewAccessMutualTlsCertificate(ctx *Context, name string, args AccessMutualTlsCertificateArgs, opts ...ResourceOption) (*AccessMutualTlsCertificate, error)
    public AccessMutualTlsCertificate(string name, AccessMutualTlsCertificateArgs args, CustomResourceOptions? opts = null)
    public AccessMutualTlsCertificate(String name, AccessMutualTlsCertificateArgs args)
    public AccessMutualTlsCertificate(String name, AccessMutualTlsCertificateArgs args, CustomResourceOptions options)
    
    type: cloudflare:AccessMutualTlsCertificate
    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 AccessMutualTlsCertificateArgs
    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 AccessMutualTlsCertificateArgs
    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 AccessMutualTlsCertificateArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AccessMutualTlsCertificateArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AccessMutualTlsCertificateArgs
    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 accessMutualTlsCertificateResource = new Cloudflare.AccessMutualTlsCertificate("accessMutualTlsCertificateResource", new()
    {
        Name = "string",
        AccountId = "string",
        AssociatedHostnames = new[]
        {
            "string",
        },
        Certificate = "string",
        ZoneId = "string",
    });
    
    example, err := cloudflare.NewAccessMutualTlsCertificate(ctx, "accessMutualTlsCertificateResource", &cloudflare.AccessMutualTlsCertificateArgs{
    	Name:      pulumi.String("string"),
    	AccountId: pulumi.String("string"),
    	AssociatedHostnames: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Certificate: pulumi.String("string"),
    	ZoneId:      pulumi.String("string"),
    })
    
    var accessMutualTlsCertificateResource = new AccessMutualTlsCertificate("accessMutualTlsCertificateResource", AccessMutualTlsCertificateArgs.builder()
        .name("string")
        .accountId("string")
        .associatedHostnames("string")
        .certificate("string")
        .zoneId("string")
        .build());
    
    access_mutual_tls_certificate_resource = cloudflare.AccessMutualTlsCertificate("accessMutualTlsCertificateResource",
        name="string",
        account_id="string",
        associated_hostnames=["string"],
        certificate="string",
        zone_id="string")
    
    const accessMutualTlsCertificateResource = new cloudflare.AccessMutualTlsCertificate("accessMutualTlsCertificateResource", {
        name: "string",
        accountId: "string",
        associatedHostnames: ["string"],
        certificate: "string",
        zoneId: "string",
    });
    
    type: cloudflare:AccessMutualTlsCertificate
    properties:
        accountId: string
        associatedHostnames:
            - string
        certificate: string
        name: string
        zoneId: string
    

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

    Name string
    The name of the certificate.
    AccountId string
    The account identifier to target for the resource. Conflicts with zone_id.
    AssociatedHostnames List<string>
    The hostnames that will be prompted for this certificate.
    Certificate string
    The Root CA for your certificates.
    ZoneId string
    The zone identifier to target for the resource. Conflicts with account_id.
    Name string
    The name of the certificate.
    AccountId string
    The account identifier to target for the resource. Conflicts with zone_id.
    AssociatedHostnames []string
    The hostnames that will be prompted for this certificate.
    Certificate string
    The Root CA for your certificates.
    ZoneId string
    The zone identifier to target for the resource. Conflicts with account_id.
    name String
    The name of the certificate.
    accountId String
    The account identifier to target for the resource. Conflicts with zone_id.
    associatedHostnames List<String>
    The hostnames that will be prompted for this certificate.
    certificate String
    The Root CA for your certificates.
    zoneId String
    The zone identifier to target for the resource. Conflicts with account_id.
    name string
    The name of the certificate.
    accountId string
    The account identifier to target for the resource. Conflicts with zone_id.
    associatedHostnames string[]
    The hostnames that will be prompted for this certificate.
    certificate string
    The Root CA for your certificates.
    zoneId string
    The zone identifier to target for the resource. Conflicts with account_id.
    name str
    The name of the certificate.
    account_id str
    The account identifier to target for the resource. Conflicts with zone_id.
    associated_hostnames Sequence[str]
    The hostnames that will be prompted for this certificate.
    certificate str
    The Root CA for your certificates.
    zone_id str
    The zone identifier to target for the resource. Conflicts with account_id.
    name String
    The name of the certificate.
    accountId String
    The account identifier to target for the resource. Conflicts with zone_id.
    associatedHostnames List<String>
    The hostnames that will be prompted for this certificate.
    certificate String
    The Root CA for your certificates.
    zoneId String
    The zone identifier to target for the resource. Conflicts with account_id.

    Outputs

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

    Fingerprint string
    Id string
    The provider-assigned unique ID for this managed resource.
    Fingerprint string
    Id string
    The provider-assigned unique ID for this managed resource.
    fingerprint String
    id String
    The provider-assigned unique ID for this managed resource.
    fingerprint string
    id string
    The provider-assigned unique ID for this managed resource.
    fingerprint str
    id str
    The provider-assigned unique ID for this managed resource.
    fingerprint String
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing AccessMutualTlsCertificate Resource

    Get an existing AccessMutualTlsCertificate 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?: AccessMutualTlsCertificateState, opts?: CustomResourceOptions): AccessMutualTlsCertificate
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_id: Optional[str] = None,
            associated_hostnames: Optional[Sequence[str]] = None,
            certificate: Optional[str] = None,
            fingerprint: Optional[str] = None,
            name: Optional[str] = None,
            zone_id: Optional[str] = None) -> AccessMutualTlsCertificate
    func GetAccessMutualTlsCertificate(ctx *Context, name string, id IDInput, state *AccessMutualTlsCertificateState, opts ...ResourceOption) (*AccessMutualTlsCertificate, error)
    public static AccessMutualTlsCertificate Get(string name, Input<string> id, AccessMutualTlsCertificateState? state, CustomResourceOptions? opts = null)
    public static AccessMutualTlsCertificate get(String name, Output<String> id, AccessMutualTlsCertificateState 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:
    AccountId string
    The account identifier to target for the resource. Conflicts with zone_id.
    AssociatedHostnames List<string>
    The hostnames that will be prompted for this certificate.
    Certificate string
    The Root CA for your certificates.
    Fingerprint string
    Name string
    The name of the certificate.
    ZoneId string
    The zone identifier to target for the resource. Conflicts with account_id.
    AccountId string
    The account identifier to target for the resource. Conflicts with zone_id.
    AssociatedHostnames []string
    The hostnames that will be prompted for this certificate.
    Certificate string
    The Root CA for your certificates.
    Fingerprint string
    Name string
    The name of the certificate.
    ZoneId string
    The zone identifier to target for the resource. Conflicts with account_id.
    accountId String
    The account identifier to target for the resource. Conflicts with zone_id.
    associatedHostnames List<String>
    The hostnames that will be prompted for this certificate.
    certificate String
    The Root CA for your certificates.
    fingerprint String
    name String
    The name of the certificate.
    zoneId String
    The zone identifier to target for the resource. Conflicts with account_id.
    accountId string
    The account identifier to target for the resource. Conflicts with zone_id.
    associatedHostnames string[]
    The hostnames that will be prompted for this certificate.
    certificate string
    The Root CA for your certificates.
    fingerprint string
    name string
    The name of the certificate.
    zoneId string
    The zone identifier to target for the resource. Conflicts with account_id.
    account_id str
    The account identifier to target for the resource. Conflicts with zone_id.
    associated_hostnames Sequence[str]
    The hostnames that will be prompted for this certificate.
    certificate str
    The Root CA for your certificates.
    fingerprint str
    name str
    The name of the certificate.
    zone_id str
    The zone identifier to target for the resource. Conflicts with account_id.
    accountId String
    The account identifier to target for the resource. Conflicts with zone_id.
    associatedHostnames List<String>
    The hostnames that will be prompted for this certificate.
    certificate String
    The Root CA for your certificates.
    fingerprint String
    name String
    The name of the certificate.
    zoneId String
    The zone identifier to target for the resource. Conflicts with account_id.

    Import

    Account level import.

    $ pulumi import cloudflare:index/accessMutualTlsCertificate:AccessMutualTlsCertificate example account/<account_id>/<mutual_tls_certificate_id>
    

    Zone level import.

    $ pulumi import cloudflare:index/accessMutualTlsCertificate:AccessMutualTlsCertificate example zone/<zone_id>/<mutual_tls_certificate_id>
    

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

    Package Details

    Repository
    Cloudflare pulumi/pulumi-cloudflare
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the cloudflare Terraform Provider.
    cloudflare logo
    Cloudflare v5.33.1 published on Wednesday, Jun 26, 2024 by Pulumi