1. Packages
  2. Cloudflare
  3. API Docs
  4. OriginCaCertificate
Cloudflare v5.23.0 published on Monday, Mar 25, 2024 by Pulumi

cloudflare.OriginCaCertificate

Explore with Pulumi AI

cloudflare logo
Cloudflare v5.23.0 published on Monday, Mar 25, 2024 by Pulumi

    Provides a Cloudflare Origin CA certificate used to protect traffic to your origin without involving a third party Certificate Authority.

    Since v3.32.0 all authentication schemes are supported for managing Origin CA certificates. Versions prior to v3.32.0 will still need to use api_user_service_key.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as cloudflare from "@pulumi/cloudflare";
    import * as tls from "@pulumi/tls";
    
    const examplePrivateKey = new tls.PrivateKey("examplePrivateKey", {algorithm: "RSA"});
    const exampleCertRequest = new tls.CertRequest("exampleCertRequest", {
        privateKeyPem: examplePrivateKey.privateKeyPem,
        subjects: [{
            commonName: "",
            organization: "Terraform Test",
        }],
    });
    const exampleOriginCaCertificate = new cloudflare.OriginCaCertificate("exampleOriginCaCertificate", {
        csr: exampleCertRequest.certRequestPem,
        hostnames: ["example.com"],
        requestType: "origin-rsa",
        requestedValidity: 7,
    });
    
    import pulumi
    import pulumi_cloudflare as cloudflare
    import pulumi_tls as tls
    
    example_private_key = tls.PrivateKey("examplePrivateKey", algorithm="RSA")
    example_cert_request = tls.CertRequest("exampleCertRequest",
        private_key_pem=example_private_key.private_key_pem,
        subjects=[tls.CertRequestSubjectArgs(
            common_name="",
            organization="Terraform Test",
        )])
    example_origin_ca_certificate = cloudflare.OriginCaCertificate("exampleOriginCaCertificate",
        csr=example_cert_request.cert_request_pem,
        hostnames=["example.com"],
        request_type="origin-rsa",
        requested_validity=7)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
    	"github.com/pulumi/pulumi-tls/sdk/v4/go/tls"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		examplePrivateKey, err := tls.NewPrivateKey(ctx, "examplePrivateKey", &tls.PrivateKeyArgs{
    			Algorithm: pulumi.String("RSA"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleCertRequest, err := tls.NewCertRequest(ctx, "exampleCertRequest", &tls.CertRequestArgs{
    			PrivateKeyPem: examplePrivateKey.PrivateKeyPem,
    			Subjects: tls.CertRequestSubjectArray{
    				&tls.CertRequestSubjectArgs{
    					CommonName:   pulumi.String(""),
    					Organization: pulumi.String("Terraform Test"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = cloudflare.NewOriginCaCertificate(ctx, "exampleOriginCaCertificate", &cloudflare.OriginCaCertificateArgs{
    			Csr: exampleCertRequest.CertRequestPem,
    			Hostnames: pulumi.StringArray{
    				pulumi.String("example.com"),
    			},
    			RequestType:       pulumi.String("origin-rsa"),
    			RequestedValidity: pulumi.Int(7),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Cloudflare = Pulumi.Cloudflare;
    using Tls = Pulumi.Tls;
    
    return await Deployment.RunAsync(() => 
    {
        var examplePrivateKey = new Tls.PrivateKey("examplePrivateKey", new()
        {
            Algorithm = "RSA",
        });
    
        var exampleCertRequest = new Tls.CertRequest("exampleCertRequest", new()
        {
            PrivateKeyPem = examplePrivateKey.PrivateKeyPem,
            Subjects = new[]
            {
                new Tls.Inputs.CertRequestSubjectArgs
                {
                    CommonName = "",
                    Organization = "Terraform Test",
                },
            },
        });
    
        var exampleOriginCaCertificate = new Cloudflare.OriginCaCertificate("exampleOriginCaCertificate", new()
        {
            Csr = exampleCertRequest.CertRequestPem,
            Hostnames = new[]
            {
                "example.com",
            },
            RequestType = "origin-rsa",
            RequestedValidity = 7,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tls.PrivateKey;
    import com.pulumi.tls.PrivateKeyArgs;
    import com.pulumi.tls.CertRequest;
    import com.pulumi.tls.CertRequestArgs;
    import com.pulumi.tls.inputs.CertRequestSubjectArgs;
    import com.pulumi.cloudflare.OriginCaCertificate;
    import com.pulumi.cloudflare.OriginCaCertificateArgs;
    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 examplePrivateKey = new PrivateKey("examplePrivateKey", PrivateKeyArgs.builder()        
                .algorithm("RSA")
                .build());
    
            var exampleCertRequest = new CertRequest("exampleCertRequest", CertRequestArgs.builder()        
                .privateKeyPem(examplePrivateKey.privateKeyPem())
                .subjects(CertRequestSubjectArgs.builder()
                    .commonName("")
                    .organization("Terraform Test")
                    .build())
                .build());
    
            var exampleOriginCaCertificate = new OriginCaCertificate("exampleOriginCaCertificate", OriginCaCertificateArgs.builder()        
                .csr(exampleCertRequest.certRequestPem())
                .hostnames("example.com")
                .requestType("origin-rsa")
                .requestedValidity(7)
                .build());
    
        }
    }
    
    resources:
      examplePrivateKey:
        type: tls:PrivateKey
        properties:
          algorithm: RSA
      exampleCertRequest:
        type: tls:CertRequest
        properties:
          privateKeyPem: ${examplePrivateKey.privateKeyPem}
          subjects:
            - commonName:
              organization: Terraform Test
      exampleOriginCaCertificate:
        type: cloudflare:OriginCaCertificate
        properties:
          csr: ${exampleCertRequest.certRequestPem}
          hostnames:
            - example.com
          requestType: origin-rsa
          requestedValidity: 7
    

    Create OriginCaCertificate Resource

    new OriginCaCertificate(name: string, args: OriginCaCertificateArgs, opts?: CustomResourceOptions);
    @overload
    def OriginCaCertificate(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            csr: Optional[str] = None,
                            hostnames: Optional[Sequence[str]] = None,
                            min_days_for_renewal: Optional[int] = None,
                            request_type: Optional[str] = None,
                            requested_validity: Optional[int] = None)
    @overload
    def OriginCaCertificate(resource_name: str,
                            args: OriginCaCertificateArgs,
                            opts: Optional[ResourceOptions] = None)
    func NewOriginCaCertificate(ctx *Context, name string, args OriginCaCertificateArgs, opts ...ResourceOption) (*OriginCaCertificate, error)
    public OriginCaCertificate(string name, OriginCaCertificateArgs args, CustomResourceOptions? opts = null)
    public OriginCaCertificate(String name, OriginCaCertificateArgs args)
    public OriginCaCertificate(String name, OriginCaCertificateArgs args, CustomResourceOptions options)
    
    type: cloudflare:OriginCaCertificate
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args OriginCaCertificateArgs
    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 OriginCaCertificateArgs
    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 OriginCaCertificateArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args OriginCaCertificateArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args OriginCaCertificateArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    Csr string
    The Certificate Signing Request. Must be newline-encoded. Modifying this attribute will force creation of a new resource.
    Hostnames List<string>
    A list of hostnames or wildcard names bound to the certificate. Modifying this attribute will force creation of a new resource.
    RequestType string
    The signature type desired on the certificate. Available values: origin-rsa, origin-ecc, keyless-certificate. Modifying this attribute will force creation of a new resource.
    MinDaysForRenewal int
    Number of days prior to the expiry to trigger a renewal of the certificate if a Terraform operation is run.
    RequestedValidity int
    The number of days for which the certificate should be valid. Available values: 7, 30, 90, 365, 730, 1095, 5475. Modifying this attribute will force creation of a new resource.
    Csr string
    The Certificate Signing Request. Must be newline-encoded. Modifying this attribute will force creation of a new resource.
    Hostnames []string
    A list of hostnames or wildcard names bound to the certificate. Modifying this attribute will force creation of a new resource.
    RequestType string
    The signature type desired on the certificate. Available values: origin-rsa, origin-ecc, keyless-certificate. Modifying this attribute will force creation of a new resource.
    MinDaysForRenewal int
    Number of days prior to the expiry to trigger a renewal of the certificate if a Terraform operation is run.
    RequestedValidity int
    The number of days for which the certificate should be valid. Available values: 7, 30, 90, 365, 730, 1095, 5475. Modifying this attribute will force creation of a new resource.
    csr String
    The Certificate Signing Request. Must be newline-encoded. Modifying this attribute will force creation of a new resource.
    hostnames List<String>
    A list of hostnames or wildcard names bound to the certificate. Modifying this attribute will force creation of a new resource.
    requestType String
    The signature type desired on the certificate. Available values: origin-rsa, origin-ecc, keyless-certificate. Modifying this attribute will force creation of a new resource.
    minDaysForRenewal Integer
    Number of days prior to the expiry to trigger a renewal of the certificate if a Terraform operation is run.
    requestedValidity Integer
    The number of days for which the certificate should be valid. Available values: 7, 30, 90, 365, 730, 1095, 5475. Modifying this attribute will force creation of a new resource.
    csr string
    The Certificate Signing Request. Must be newline-encoded. Modifying this attribute will force creation of a new resource.
    hostnames string[]
    A list of hostnames or wildcard names bound to the certificate. Modifying this attribute will force creation of a new resource.
    requestType string
    The signature type desired on the certificate. Available values: origin-rsa, origin-ecc, keyless-certificate. Modifying this attribute will force creation of a new resource.
    minDaysForRenewal number
    Number of days prior to the expiry to trigger a renewal of the certificate if a Terraform operation is run.
    requestedValidity number
    The number of days for which the certificate should be valid. Available values: 7, 30, 90, 365, 730, 1095, 5475. Modifying this attribute will force creation of a new resource.
    csr str
    The Certificate Signing Request. Must be newline-encoded. Modifying this attribute will force creation of a new resource.
    hostnames Sequence[str]
    A list of hostnames or wildcard names bound to the certificate. Modifying this attribute will force creation of a new resource.
    request_type str
    The signature type desired on the certificate. Available values: origin-rsa, origin-ecc, keyless-certificate. Modifying this attribute will force creation of a new resource.
    min_days_for_renewal int
    Number of days prior to the expiry to trigger a renewal of the certificate if a Terraform operation is run.
    requested_validity int
    The number of days for which the certificate should be valid. Available values: 7, 30, 90, 365, 730, 1095, 5475. Modifying this attribute will force creation of a new resource.
    csr String
    The Certificate Signing Request. Must be newline-encoded. Modifying this attribute will force creation of a new resource.
    hostnames List<String>
    A list of hostnames or wildcard names bound to the certificate. Modifying this attribute will force creation of a new resource.
    requestType String
    The signature type desired on the certificate. Available values: origin-rsa, origin-ecc, keyless-certificate. Modifying this attribute will force creation of a new resource.
    minDaysForRenewal Number
    Number of days prior to the expiry to trigger a renewal of the certificate if a Terraform operation is run.
    requestedValidity Number
    The number of days for which the certificate should be valid. Available values: 7, 30, 90, 365, 730, 1095, 5475. Modifying this attribute will force creation of a new resource.

    Outputs

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

    Certificate string
    The Origin CA certificate.
    ExpiresOn string
    The datetime when the certificate will expire.
    Id string
    The provider-assigned unique ID for this managed resource.
    Certificate string
    The Origin CA certificate.
    ExpiresOn string
    The datetime when the certificate will expire.
    Id string
    The provider-assigned unique ID for this managed resource.
    certificate String
    The Origin CA certificate.
    expiresOn String
    The datetime when the certificate will expire.
    id String
    The provider-assigned unique ID for this managed resource.
    certificate string
    The Origin CA certificate.
    expiresOn string
    The datetime when the certificate will expire.
    id string
    The provider-assigned unique ID for this managed resource.
    certificate str
    The Origin CA certificate.
    expires_on str
    The datetime when the certificate will expire.
    id str
    The provider-assigned unique ID for this managed resource.
    certificate String
    The Origin CA certificate.
    expiresOn String
    The datetime when the certificate will expire.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing OriginCaCertificate Resource

    Get an existing OriginCaCertificate 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?: OriginCaCertificateState, opts?: CustomResourceOptions): OriginCaCertificate
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            certificate: Optional[str] = None,
            csr: Optional[str] = None,
            expires_on: Optional[str] = None,
            hostnames: Optional[Sequence[str]] = None,
            min_days_for_renewal: Optional[int] = None,
            request_type: Optional[str] = None,
            requested_validity: Optional[int] = None) -> OriginCaCertificate
    func GetOriginCaCertificate(ctx *Context, name string, id IDInput, state *OriginCaCertificateState, opts ...ResourceOption) (*OriginCaCertificate, error)
    public static OriginCaCertificate Get(string name, Input<string> id, OriginCaCertificateState? state, CustomResourceOptions? opts = null)
    public static OriginCaCertificate get(String name, Output<String> id, OriginCaCertificateState 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:
    Certificate string
    The Origin CA certificate.
    Csr string
    The Certificate Signing Request. Must be newline-encoded. Modifying this attribute will force creation of a new resource.
    ExpiresOn string
    The datetime when the certificate will expire.
    Hostnames List<string>
    A list of hostnames or wildcard names bound to the certificate. Modifying this attribute will force creation of a new resource.
    MinDaysForRenewal int
    Number of days prior to the expiry to trigger a renewal of the certificate if a Terraform operation is run.
    RequestType string
    The signature type desired on the certificate. Available values: origin-rsa, origin-ecc, keyless-certificate. Modifying this attribute will force creation of a new resource.
    RequestedValidity int
    The number of days for which the certificate should be valid. Available values: 7, 30, 90, 365, 730, 1095, 5475. Modifying this attribute will force creation of a new resource.
    Certificate string
    The Origin CA certificate.
    Csr string
    The Certificate Signing Request. Must be newline-encoded. Modifying this attribute will force creation of a new resource.
    ExpiresOn string
    The datetime when the certificate will expire.
    Hostnames []string
    A list of hostnames or wildcard names bound to the certificate. Modifying this attribute will force creation of a new resource.
    MinDaysForRenewal int
    Number of days prior to the expiry to trigger a renewal of the certificate if a Terraform operation is run.
    RequestType string
    The signature type desired on the certificate. Available values: origin-rsa, origin-ecc, keyless-certificate. Modifying this attribute will force creation of a new resource.
    RequestedValidity int
    The number of days for which the certificate should be valid. Available values: 7, 30, 90, 365, 730, 1095, 5475. Modifying this attribute will force creation of a new resource.
    certificate String
    The Origin CA certificate.
    csr String
    The Certificate Signing Request. Must be newline-encoded. Modifying this attribute will force creation of a new resource.
    expiresOn String
    The datetime when the certificate will expire.
    hostnames List<String>
    A list of hostnames or wildcard names bound to the certificate. Modifying this attribute will force creation of a new resource.
    minDaysForRenewal Integer
    Number of days prior to the expiry to trigger a renewal of the certificate if a Terraform operation is run.
    requestType String
    The signature type desired on the certificate. Available values: origin-rsa, origin-ecc, keyless-certificate. Modifying this attribute will force creation of a new resource.
    requestedValidity Integer
    The number of days for which the certificate should be valid. Available values: 7, 30, 90, 365, 730, 1095, 5475. Modifying this attribute will force creation of a new resource.
    certificate string
    The Origin CA certificate.
    csr string
    The Certificate Signing Request. Must be newline-encoded. Modifying this attribute will force creation of a new resource.
    expiresOn string
    The datetime when the certificate will expire.
    hostnames string[]
    A list of hostnames or wildcard names bound to the certificate. Modifying this attribute will force creation of a new resource.
    minDaysForRenewal number
    Number of days prior to the expiry to trigger a renewal of the certificate if a Terraform operation is run.
    requestType string
    The signature type desired on the certificate. Available values: origin-rsa, origin-ecc, keyless-certificate. Modifying this attribute will force creation of a new resource.
    requestedValidity number
    The number of days for which the certificate should be valid. Available values: 7, 30, 90, 365, 730, 1095, 5475. Modifying this attribute will force creation of a new resource.
    certificate str
    The Origin CA certificate.
    csr str
    The Certificate Signing Request. Must be newline-encoded. Modifying this attribute will force creation of a new resource.
    expires_on str
    The datetime when the certificate will expire.
    hostnames Sequence[str]
    A list of hostnames or wildcard names bound to the certificate. Modifying this attribute will force creation of a new resource.
    min_days_for_renewal int
    Number of days prior to the expiry to trigger a renewal of the certificate if a Terraform operation is run.
    request_type str
    The signature type desired on the certificate. Available values: origin-rsa, origin-ecc, keyless-certificate. Modifying this attribute will force creation of a new resource.
    requested_validity int
    The number of days for which the certificate should be valid. Available values: 7, 30, 90, 365, 730, 1095, 5475. Modifying this attribute will force creation of a new resource.
    certificate String
    The Origin CA certificate.
    csr String
    The Certificate Signing Request. Must be newline-encoded. Modifying this attribute will force creation of a new resource.
    expiresOn String
    The datetime when the certificate will expire.
    hostnames List<String>
    A list of hostnames or wildcard names bound to the certificate. Modifying this attribute will force creation of a new resource.
    minDaysForRenewal Number
    Number of days prior to the expiry to trigger a renewal of the certificate if a Terraform operation is run.
    requestType String
    The signature type desired on the certificate. Available values: origin-rsa, origin-ecc, keyless-certificate. Modifying this attribute will force creation of a new resource.
    requestedValidity Number
    The number of days for which the certificate should be valid. Available values: 7, 30, 90, 365, 730, 1095, 5475. Modifying this attribute will force creation of a new resource.

    Import

    $ pulumi import cloudflare:index/originCaCertificate:OriginCaCertificate example <certificate_id>
    

    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.23.0 published on Monday, Mar 25, 2024 by Pulumi