okta.DomainCertificate
Explore with Pulumi AI
Manages certificate for the domain. This resource’s ‘certificate’, ‘private_key’, and ‘certificate_chain’ attributes hold actual PEM values and can be referred to by other configs requiring certificate and private key inputs. This is inline with TF’s best practices of not encrypting state. See Let’s Encrypt Certbot notes at the end of this documentation for notes on how to generate a domain certificate with Let’s Encrypt Certbot
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as okta from "@pulumi/okta";
const example = new okta.Domain("example", {name: "www.example.com"});
const test = new okta.DomainCertificate("test", {
domainId: testOktaDomain.id,
type: "PEM",
certificate: `-----BEGIN CERTIFICATE-----
MIIFNzCCBB+gAwIBAgISBAXomJWRama3ypu8TIxdA9wzMA0GCSqGSIb3DQEBCwUA
...
NSgRtSXq11j8O4JONi8EXe7cEtvzUiLR5PL3itsK2svtrZ9jIwQ95wOPaA==
-----END CERTIFICATE-----
`,
certificateChain: `-----BEGIN CERTIFICATE-----
MIIFFjCCAv6gAwIBAgIRAJErCErPDBinU/bWLiWnX1owDQYJKoZIhvcNAQELBQAw
...
Dfvp7OOGAN6dEOM4+qR9sdjoSYKEBpsr6GtPAQw4dy753ec5
-----END CERTIFICATE-----
`,
privateKey: `-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC5cyk6x63iBJSW
...
nUFLNE8pXSnsqb0eOL74f3uQ
-----END PRIVATE KEY-----
`,
});
import pulumi
import pulumi_okta as okta
example = okta.Domain("example", name="www.example.com")
test = okta.DomainCertificate("test",
domain_id=test_okta_domain["id"],
type="PEM",
certificate="""-----BEGIN CERTIFICATE-----
MIIFNzCCBB+gAwIBAgISBAXomJWRama3ypu8TIxdA9wzMA0GCSqGSIb3DQEBCwUA
...
NSgRtSXq11j8O4JONi8EXe7cEtvzUiLR5PL3itsK2svtrZ9jIwQ95wOPaA==
-----END CERTIFICATE-----
""",
certificate_chain="""-----BEGIN CERTIFICATE-----
MIIFFjCCAv6gAwIBAgIRAJErCErPDBinU/bWLiWnX1owDQYJKoZIhvcNAQELBQAw
...
Dfvp7OOGAN6dEOM4+qR9sdjoSYKEBpsr6GtPAQw4dy753ec5
-----END CERTIFICATE-----
""",
private_key="""-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC5cyk6x63iBJSW
...
nUFLNE8pXSnsqb0eOL74f3uQ
-----END PRIVATE KEY-----
""")
package main
import (
"github.com/pulumi/pulumi-okta/sdk/v4/go/okta"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := okta.NewDomain(ctx, "example", &okta.DomainArgs{
Name: pulumi.String("www.example.com"),
})
if err != nil {
return err
}
_, err = okta.NewDomainCertificate(ctx, "test", &okta.DomainCertificateArgs{
DomainId: pulumi.Any(testOktaDomain.Id),
Type: pulumi.String("PEM"),
Certificate: pulumi.String(`-----BEGIN CERTIFICATE-----
MIIFNzCCBB+gAwIBAgISBAXomJWRama3ypu8TIxdA9wzMA0GCSqGSIb3DQEBCwUA
...
NSgRtSXq11j8O4JONi8EXe7cEtvzUiLR5PL3itsK2svtrZ9jIwQ95wOPaA==
-----END CERTIFICATE-----
`),
CertificateChain: pulumi.String(`-----BEGIN CERTIFICATE-----
MIIFFjCCAv6gAwIBAgIRAJErCErPDBinU/bWLiWnX1owDQYJKoZIhvcNAQELBQAw
...
Dfvp7OOGAN6dEOM4+qR9sdjoSYKEBpsr6GtPAQw4dy753ec5
-----END CERTIFICATE-----
`),
PrivateKey: pulumi.String(`-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC5cyk6x63iBJSW
...
nUFLNE8pXSnsqb0eOL74f3uQ
-----END PRIVATE KEY-----
`),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Okta = Pulumi.Okta;
return await Deployment.RunAsync(() =>
{
var example = new Okta.Domain("example", new()
{
Name = "www.example.com",
});
var test = new Okta.DomainCertificate("test", new()
{
DomainId = testOktaDomain.Id,
Type = "PEM",
Certificate = @"-----BEGIN CERTIFICATE-----
MIIFNzCCBB+gAwIBAgISBAXomJWRama3ypu8TIxdA9wzMA0GCSqGSIb3DQEBCwUA
...
NSgRtSXq11j8O4JONi8EXe7cEtvzUiLR5PL3itsK2svtrZ9jIwQ95wOPaA==
-----END CERTIFICATE-----
",
CertificateChain = @"-----BEGIN CERTIFICATE-----
MIIFFjCCAv6gAwIBAgIRAJErCErPDBinU/bWLiWnX1owDQYJKoZIhvcNAQELBQAw
...
Dfvp7OOGAN6dEOM4+qR9sdjoSYKEBpsr6GtPAQw4dy753ec5
-----END CERTIFICATE-----
",
PrivateKey = @"-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC5cyk6x63iBJSW
...
nUFLNE8pXSnsqb0eOL74f3uQ
-----END PRIVATE KEY-----
",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.okta.Domain;
import com.pulumi.okta.DomainArgs;
import com.pulumi.okta.DomainCertificate;
import com.pulumi.okta.DomainCertificateArgs;
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 Domain("example", DomainArgs.builder()
.name("www.example.com")
.build());
var test = new DomainCertificate("test", DomainCertificateArgs.builder()
.domainId(testOktaDomain.id())
.type("PEM")
.certificate("""
-----BEGIN CERTIFICATE-----
MIIFNzCCBB+gAwIBAgISBAXomJWRama3ypu8TIxdA9wzMA0GCSqGSIb3DQEBCwUA
...
NSgRtSXq11j8O4JONi8EXe7cEtvzUiLR5PL3itsK2svtrZ9jIwQ95wOPaA==
-----END CERTIFICATE-----
""")
.certificateChain("""
-----BEGIN CERTIFICATE-----
MIIFFjCCAv6gAwIBAgIRAJErCErPDBinU/bWLiWnX1owDQYJKoZIhvcNAQELBQAw
...
Dfvp7OOGAN6dEOM4+qR9sdjoSYKEBpsr6GtPAQw4dy753ec5
-----END CERTIFICATE-----
""")
.privateKey("""
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC5cyk6x63iBJSW
...
nUFLNE8pXSnsqb0eOL74f3uQ
-----END PRIVATE KEY-----
""")
.build());
}
}
resources:
example:
type: okta:Domain
properties:
name: www.example.com
test:
type: okta:DomainCertificate
properties:
domainId: ${testOktaDomain.id}
type: PEM
certificate: |
-----BEGIN CERTIFICATE-----
MIIFNzCCBB+gAwIBAgISBAXomJWRama3ypu8TIxdA9wzMA0GCSqGSIb3DQEBCwUA
...
NSgRtSXq11j8O4JONi8EXe7cEtvzUiLR5PL3itsK2svtrZ9jIwQ95wOPaA==
-----END CERTIFICATE-----
certificateChain: |
-----BEGIN CERTIFICATE-----
MIIFFjCCAv6gAwIBAgIRAJErCErPDBinU/bWLiWnX1owDQYJKoZIhvcNAQELBQAw
...
Dfvp7OOGAN6dEOM4+qR9sdjoSYKEBpsr6GtPAQw4dy753ec5
-----END CERTIFICATE-----
privateKey: |
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC5cyk6x63iBJSW
...
nUFLNE8pXSnsqb0eOL74f3uQ
-----END PRIVATE KEY-----
Let’s Encrypt Certbot
This example demonstrates generatoring a domain certificate with letsencrypt certbot https://letsencrypt.org/getting-started/
$ certbot certonly --manual --preferred-challenges dns --key-type rsa -d [DOMAIN]
Use letsencrypt’s certbot to generate domain certificates in RSA output mode.
The generator’s output corresponds to okta.DomainCertificate
fields in the
following manner.
Okta Field | Certbot file |
---|---|
certificate | cert.pem |
certificate_chain | chain.pem |
private_key | privkey.pem |
Create DomainCertificate Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new DomainCertificate(name: string, args: DomainCertificateArgs, opts?: CustomResourceOptions);
@overload
def DomainCertificate(resource_name: str,
args: DomainCertificateArgs,
opts: Optional[ResourceOptions] = None)
@overload
def DomainCertificate(resource_name: str,
opts: Optional[ResourceOptions] = None,
certificate: Optional[str] = None,
certificate_chain: Optional[str] = None,
domain_id: Optional[str] = None,
private_key: Optional[str] = None,
type: Optional[str] = None)
func NewDomainCertificate(ctx *Context, name string, args DomainCertificateArgs, opts ...ResourceOption) (*DomainCertificate, error)
public DomainCertificate(string name, DomainCertificateArgs args, CustomResourceOptions? opts = null)
public DomainCertificate(String name, DomainCertificateArgs args)
public DomainCertificate(String name, DomainCertificateArgs args, CustomResourceOptions options)
type: okta:DomainCertificate
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 DomainCertificateArgs
- 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 DomainCertificateArgs
- 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 DomainCertificateArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DomainCertificateArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args DomainCertificateArgs
- 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 domainCertificateResource = new Okta.DomainCertificate("domainCertificateResource", new()
{
Certificate = "string",
CertificateChain = "string",
DomainId = "string",
PrivateKey = "string",
Type = "string",
});
example, err := okta.NewDomainCertificate(ctx, "domainCertificateResource", &okta.DomainCertificateArgs{
Certificate: pulumi.String("string"),
CertificateChain: pulumi.String("string"),
DomainId: pulumi.String("string"),
PrivateKey: pulumi.String("string"),
Type: pulumi.String("string"),
})
var domainCertificateResource = new DomainCertificate("domainCertificateResource", DomainCertificateArgs.builder()
.certificate("string")
.certificateChain("string")
.domainId("string")
.privateKey("string")
.type("string")
.build());
domain_certificate_resource = okta.DomainCertificate("domainCertificateResource",
certificate="string",
certificate_chain="string",
domain_id="string",
private_key="string",
type="string")
const domainCertificateResource = new okta.DomainCertificate("domainCertificateResource", {
certificate: "string",
certificateChain: "string",
domainId: "string",
privateKey: "string",
type: "string",
});
type: okta:DomainCertificate
properties:
certificate: string
certificateChain: string
domainId: string
privateKey: string
type: string
DomainCertificate 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 DomainCertificate resource accepts the following input properties:
- Certificate string
- Certificate content
- Certificate
Chain string - Certificate chain
- Domain
Id string - Domain's ID
- Private
Key string - Certificate private key
- Type string
- Certificate type. Valid value is
PEM
- Certificate string
- Certificate content
- Certificate
Chain string - Certificate chain
- Domain
Id string - Domain's ID
- Private
Key string - Certificate private key
- Type string
- Certificate type. Valid value is
PEM
- certificate String
- Certificate content
- certificate
Chain String - Certificate chain
- domain
Id String - Domain's ID
- private
Key String - Certificate private key
- type String
- Certificate type. Valid value is
PEM
- certificate string
- Certificate content
- certificate
Chain string - Certificate chain
- domain
Id string - Domain's ID
- private
Key string - Certificate private key
- type string
- Certificate type. Valid value is
PEM
- certificate str
- Certificate content
- certificate_
chain str - Certificate chain
- domain_
id str - Domain's ID
- private_
key str - Certificate private key
- type str
- Certificate type. Valid value is
PEM
- certificate String
- Certificate content
- certificate
Chain String - Certificate chain
- domain
Id String - Domain's ID
- private
Key String - Certificate private key
- type String
- Certificate type. Valid value is
PEM
Outputs
All input properties are implicitly available as output properties. Additionally, the DomainCertificate resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing DomainCertificate Resource
Get an existing DomainCertificate 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?: DomainCertificateState, opts?: CustomResourceOptions): DomainCertificate
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
certificate: Optional[str] = None,
certificate_chain: Optional[str] = None,
domain_id: Optional[str] = None,
private_key: Optional[str] = None,
type: Optional[str] = None) -> DomainCertificate
func GetDomainCertificate(ctx *Context, name string, id IDInput, state *DomainCertificateState, opts ...ResourceOption) (*DomainCertificate, error)
public static DomainCertificate Get(string name, Input<string> id, DomainCertificateState? state, CustomResourceOptions? opts = null)
public static DomainCertificate get(String name, Output<String> id, DomainCertificateState 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
- Certificate content
- Certificate
Chain string - Certificate chain
- Domain
Id string - Domain's ID
- Private
Key string - Certificate private key
- Type string
- Certificate type. Valid value is
PEM
- Certificate string
- Certificate content
- Certificate
Chain string - Certificate chain
- Domain
Id string - Domain's ID
- Private
Key string - Certificate private key
- Type string
- Certificate type. Valid value is
PEM
- certificate String
- Certificate content
- certificate
Chain String - Certificate chain
- domain
Id String - Domain's ID
- private
Key String - Certificate private key
- type String
- Certificate type. Valid value is
PEM
- certificate string
- Certificate content
- certificate
Chain string - Certificate chain
- domain
Id string - Domain's ID
- private
Key string - Certificate private key
- type string
- Certificate type. Valid value is
PEM
- certificate str
- Certificate content
- certificate_
chain str - Certificate chain
- domain_
id str - Domain's ID
- private_
key str - Certificate private key
- type str
- Certificate type. Valid value is
PEM
- certificate String
- Certificate content
- certificate
Chain String - Certificate chain
- domain
Id String - Domain's ID
- private
Key String - Certificate private key
- type String
- Certificate type. Valid value is
PEM
Package Details
- Repository
- Okta pulumi/pulumi-okta
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
okta
Terraform Provider.