cloudflare.OriginCaCertificate
Explore with Pulumi AI
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 example = new tls.index.PrivateKey("example", {algorithm: "RSA"});
const exampleCertRequest = new tls.index.CertRequest("example", {
privateKeyPem: example.privateKeyPem,
subject: [{
commonName: "",
organization: "Terraform Test",
}],
});
const exampleOriginCaCertificate = new cloudflare.OriginCaCertificate("example", {
csr: exampleCertRequest.certRequestPem,
hostnames: ["example.com"],
requestType: "origin-rsa",
requestedValidity: 7,
});
import pulumi
import pulumi_cloudflare as cloudflare
import pulumi_tls as tls
example = tls.index.PrivateKey("example", algorithm=RSA)
example_cert_request = tls.index.CertRequest("example",
private_key_pem=example.private_key_pem,
subject=[{
commonName: ,
organization: Terraform Test,
}])
example_origin_ca_certificate = cloudflare.OriginCaCertificate("example",
csr=example_cert_request["certRequestPem"],
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 {
example, err := tls.NewPrivateKey(ctx, "example", &tls.PrivateKeyArgs{
Algorithm: "RSA",
})
if err != nil {
return err
}
exampleCertRequest, err := tls.NewCertRequest(ctx, "example", &tls.CertRequestArgs{
PrivateKeyPem: example.PrivateKeyPem,
Subject: []map[string]interface{}{
map[string]interface{}{
"commonName": "",
"organization": "Terraform Test",
},
},
})
if err != nil {
return err
}
_, err = cloudflare.NewOriginCaCertificate(ctx, "example", &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 example = new Tls.Index.PrivateKey("example", new()
{
Algorithm = "RSA",
});
var exampleCertRequest = new Tls.Index.CertRequest("example", new()
{
PrivateKeyPem = example.PrivateKeyPem,
Subject = new[]
{
{
{ "commonName", "" },
{ "organization", "Terraform Test" },
},
},
});
var exampleOriginCaCertificate = new Cloudflare.OriginCaCertificate("example", 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.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 example = new PrivateKey("example", PrivateKeyArgs.builder()
.algorithm("RSA")
.build());
var exampleCertRequest = new CertRequest("exampleCertRequest", CertRequestArgs.builder()
.privateKeyPem(example.privateKeyPem())
.subject(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
.build());
var exampleOriginCaCertificate = new OriginCaCertificate("exampleOriginCaCertificate", OriginCaCertificateArgs.builder()
.csr(exampleCertRequest.certRequestPem())
.hostnames("example.com")
.requestType("origin-rsa")
.requestedValidity(7)
.build());
}
}
resources:
example:
type: tls:privateKey
properties:
algorithm: RSA
exampleCertRequest:
type: tls:certRequest
name: example
properties:
privateKeyPem: ${example.privateKeyPem}
subject:
- commonName:
organization: Terraform Test
exampleOriginCaCertificate:
type: cloudflare:OriginCaCertificate
name: example
properties:
csr: ${exampleCertRequest.certRequestPem}
hostnames:
- example.com
requestType: origin-rsa
requestedValidity: 7
Create OriginCaCertificate Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new OriginCaCertificate(name: string, args: OriginCaCertificateArgs, opts?: CustomResourceOptions);
@overload
def OriginCaCertificate(resource_name: str,
args: OriginCaCertificateArgs,
opts: Optional[ResourceOptions] = None)
@overload
def OriginCaCertificate(resource_name: str,
opts: Optional[ResourceOptions] = None,
csr: Optional[str] = None,
hostnames: Optional[Sequence[str]] = None,
request_type: Optional[str] = None,
min_days_for_renewal: Optional[int] = None,
requested_validity: Optional[int] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var originCaCertificateResource = new Cloudflare.OriginCaCertificate("originCaCertificateResource", new()
{
Csr = "string",
Hostnames = new[]
{
"string",
},
RequestType = "string",
MinDaysForRenewal = 0,
RequestedValidity = 0,
});
example, err := cloudflare.NewOriginCaCertificate(ctx, "originCaCertificateResource", &cloudflare.OriginCaCertificateArgs{
Csr: pulumi.String("string"),
Hostnames: pulumi.StringArray{
pulumi.String("string"),
},
RequestType: pulumi.String("string"),
MinDaysForRenewal: pulumi.Int(0),
RequestedValidity: pulumi.Int(0),
})
var originCaCertificateResource = new OriginCaCertificate("originCaCertificateResource", OriginCaCertificateArgs.builder()
.csr("string")
.hostnames("string")
.requestType("string")
.minDaysForRenewal(0)
.requestedValidity(0)
.build());
origin_ca_certificate_resource = cloudflare.OriginCaCertificate("originCaCertificateResource",
csr="string",
hostnames=["string"],
request_type="string",
min_days_for_renewal=0,
requested_validity=0)
const originCaCertificateResource = new cloudflare.OriginCaCertificate("originCaCertificateResource", {
csr: "string",
hostnames: ["string"],
requestType: "string",
minDaysForRenewal: 0,
requestedValidity: 0,
});
type: cloudflare:OriginCaCertificate
properties:
csr: string
hostnames:
- string
minDaysForRenewal: 0
requestType: string
requestedValidity: 0
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
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.
- Request
Type 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. - Min
Days intFor Renewal - 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 []string
- A list of hostnames or wildcard names bound to the certificate. Modifying this attribute will force creation of a new resource.
- Request
Type 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. - Min
Days intFor Renewal - 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.
- request
Type 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. - min
Days IntegerFor Renewal - requested
Validity 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.
- request
Type 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. - min
Days numberFor Renewal - requested
Validity 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_ intfor_ renewal - 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.
- request
Type 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. - min
Days NumberFor Renewal - requested
Validity 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.
- Expires
On 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.
- Expires
On 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.
- expires
On 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.
- expires
On 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.
- expires
On 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.
- 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.
- Expires
On 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.
- Min
Days intFor Renewal - Request
Type 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. - 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.
- Expires
On 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.
- Min
Days intFor Renewal - Request
Type 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. - 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.
- expires
On 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.
- min
Days IntegerFor Renewal - request
Type 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. - requested
Validity 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.
- expires
On 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.
- min
Days numberFor Renewal - request
Type 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. - requested
Validity 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_ intfor_ renewal - 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.
- expires
On 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.
- min
Days NumberFor Renewal - request
Type 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. - requested
Validity 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>
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.