1. Packages
  2. Incapsula Provider
  3. API Docs
  4. CustomHsmCertificate
incapsula 3.33.0 published on Wednesday, Apr 30, 2025 by imperva

incapsula.CustomHsmCertificate

Explore with Pulumi AI

incapsula logo
incapsula 3.33.0 published on Wednesday, Apr 30, 2025 by imperva

    Provides an Incapsula Custom HSM Certificate resource. The certificate content must be in base64 format.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as fs from "fs";
    import * as incapsula from "@pulumi/incapsula";
    
    const hsm_custom_certificate_example = new incapsula.CustomHsmCertificate("hsm-custom-certificate-example", {
        siteId: incapsula_site["example-site"].id,
        certificate: fs.readFileSync("path/to/your/cert.pem", { encoding: "base64" }),
        apiDetails: [{
            apiId: "345345-dfg44534-d34534tdfg-dsf4435rg",
            apiKey: "Mdrghg56G5dfHER445hjy5Ghhfg5rth5435hkj3hgd8r7ty948rjslkfhiu4how3hrioeuhtiuer",
            hostname: "api.amer.smartkey.io",
        }],
    });
    
    import pulumi
    import base64
    import pulumi_incapsula as incapsula
    
    hsm_custom_certificate_example = incapsula.CustomHsmCertificate("hsm-custom-certificate-example",
        site_id=incapsula_site["example-site"]["id"],
        certificate=(lambda path: base64.b64encode(open(path).read().encode()).decode())("path/to/your/cert.pem"),
        api_details=[{
            "api_id": "345345-dfg44534-d34534tdfg-dsf4435rg",
            "api_key": "Mdrghg56G5dfHER445hjy5Ghhfg5rth5435hkj3hgd8r7ty948rjslkfhiu4how3hrioeuhtiuer",
            "hostname": "api.amer.smartkey.io",
        }])
    
    package main
    
    import (
    	"encoding/base64"
    	"os"
    
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/incapsula/v3/incapsula"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func filebase64OrPanic(path string) string {
    	if fileData, err := os.ReadFile(path); err == nil {
    		return base64.StdEncoding.EncodeToString(fileData[:])
    	} else {
    		panic(err.Error())
    	}
    }
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := incapsula.NewCustomHsmCertificate(ctx, "hsm-custom-certificate-example", &incapsula.CustomHsmCertificateArgs{
    			SiteId:      pulumi.Any(incapsula_site.ExampleSite.Id),
    			Certificate: pulumi.String(filebase64OrPanic("path/to/your/cert.pem")),
    			ApiDetails: incapsula.CustomHsmCertificateApiDetailArray{
    				&incapsula.CustomHsmCertificateApiDetailArgs{
    					ApiId:    pulumi.String("345345-dfg44534-d34534tdfg-dsf4435rg"),
    					ApiKey:   pulumi.String("Mdrghg56G5dfHER445hjy5Ghhfg5rth5435hkj3hgd8r7ty948rjslkfhiu4how3hrioeuhtiuer"),
    					Hostname: pulumi.String("api.amer.smartkey.io"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using Pulumi;
    using Incapsula = Pulumi.Incapsula;
    
    	
    string ReadFileBase64(string path) 
    {
        return Convert.ToBase64String(Encoding.UTF8.GetBytes(File.ReadAllText(path)));
    }
    
    return await Deployment.RunAsync(() => 
    {
        var hsm_custom_certificate_example = new Incapsula.CustomHsmCertificate("hsm-custom-certificate-example", new()
        {
            SiteId = incapsula_site.Example_site.Id,
            Certificate = ReadFileBase64("path/to/your/cert.pem"),
            ApiDetails = new[]
            {
                new Incapsula.Inputs.CustomHsmCertificateApiDetailArgs
                {
                    ApiId = "345345-dfg44534-d34534tdfg-dsf4435rg",
                    ApiKey = "Mdrghg56G5dfHER445hjy5Ghhfg5rth5435hkj3hgd8r7ty948rjslkfhiu4how3hrioeuhtiuer",
                    Hostname = "api.amer.smartkey.io",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.incapsula.CustomHsmCertificate;
    import com.pulumi.incapsula.CustomHsmCertificateArgs;
    import com.pulumi.incapsula.inputs.CustomHsmCertificateApiDetailArgs;
    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 hsm_custom_certificate_example = new CustomHsmCertificate("hsm-custom-certificate-example", CustomHsmCertificateArgs.builder()
                .siteId(incapsula_site.example-site().id())
                .certificate(Base64.getEncoder().encodeToString(Files.readAllBytes(Paths.get("path/to/your/cert.pem"))))
                .apiDetails(CustomHsmCertificateApiDetailArgs.builder()
                    .apiId("345345-dfg44534-d34534tdfg-dsf4435rg")
                    .apiKey("Mdrghg56G5dfHER445hjy5Ghhfg5rth5435hkj3hgd8r7ty948rjslkfhiu4how3hrioeuhtiuer")
                    .hostname("api.amer.smartkey.io")
                    .build())
                .build());
    
        }
    }
    
    Coming soon!
    

    Create CustomHsmCertificate Resource

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

    Constructor syntax

    new CustomHsmCertificate(name: string, args: CustomHsmCertificateArgs, opts?: CustomResourceOptions);
    @overload
    def CustomHsmCertificate(resource_name: str,
                             args: CustomHsmCertificateArgs,
                             opts: Optional[ResourceOptions] = None)
    
    @overload
    def CustomHsmCertificate(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             certificate: Optional[str] = None,
                             site_id: Optional[str] = None,
                             api_details: Optional[Sequence[CustomHsmCertificateApiDetailArgs]] = None,
                             custom_hsm_certificate_id: Optional[str] = None,
                             input_hash: Optional[str] = None)
    func NewCustomHsmCertificate(ctx *Context, name string, args CustomHsmCertificateArgs, opts ...ResourceOption) (*CustomHsmCertificate, error)
    public CustomHsmCertificate(string name, CustomHsmCertificateArgs args, CustomResourceOptions? opts = null)
    public CustomHsmCertificate(String name, CustomHsmCertificateArgs args)
    public CustomHsmCertificate(String name, CustomHsmCertificateArgs args, CustomResourceOptions options)
    
    type: incapsula:CustomHsmCertificate
    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 CustomHsmCertificateArgs
    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 CustomHsmCertificateArgs
    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 CustomHsmCertificateArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CustomHsmCertificateArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CustomHsmCertificateArgs
    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 customHsmCertificateResource = new Incapsula.CustomHsmCertificate("customHsmCertificateResource", new()
    {
        Certificate = "string",
        SiteId = "string",
        ApiDetails = new[]
        {
            new Incapsula.Inputs.CustomHsmCertificateApiDetailArgs
            {
                ApiId = "string",
                ApiKey = "string",
                Hostname = "string",
            },
        },
        CustomHsmCertificateId = "string",
        InputHash = "string",
    });
    
    example, err := incapsula.NewCustomHsmCertificate(ctx, "customHsmCertificateResource", &incapsula.CustomHsmCertificateArgs{
    	Certificate: pulumi.String("string"),
    	SiteId:      pulumi.String("string"),
    	ApiDetails: incapsula.CustomHsmCertificateApiDetailArray{
    		&incapsula.CustomHsmCertificateApiDetailArgs{
    			ApiId:    pulumi.String("string"),
    			ApiKey:   pulumi.String("string"),
    			Hostname: pulumi.String("string"),
    		},
    	},
    	CustomHsmCertificateId: pulumi.String("string"),
    	InputHash:              pulumi.String("string"),
    })
    
    var customHsmCertificateResource = new CustomHsmCertificate("customHsmCertificateResource", CustomHsmCertificateArgs.builder()
        .certificate("string")
        .siteId("string")
        .apiDetails(CustomHsmCertificateApiDetailArgs.builder()
            .apiId("string")
            .apiKey("string")
            .hostname("string")
            .build())
        .customHsmCertificateId("string")
        .inputHash("string")
        .build());
    
    custom_hsm_certificate_resource = incapsula.CustomHsmCertificate("customHsmCertificateResource",
        certificate="string",
        site_id="string",
        api_details=[{
            "api_id": "string",
            "api_key": "string",
            "hostname": "string",
        }],
        custom_hsm_certificate_id="string",
        input_hash="string")
    
    const customHsmCertificateResource = new incapsula.CustomHsmCertificate("customHsmCertificateResource", {
        certificate: "string",
        siteId: "string",
        apiDetails: [{
            apiId: "string",
            apiKey: "string",
            hostname: "string",
        }],
        customHsmCertificateId: "string",
        inputHash: "string",
    });
    
    type: incapsula:CustomHsmCertificate
    properties:
        apiDetails:
            - apiId: string
              apiKey: string
              hostname: string
        certificate: string
        customHsmCertificateId: string
        inputHash: string
        siteId: string
    

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

    Certificate string
    The certificate file in base64 format.
    SiteId string
    Numeric identifier of the site to operate on.
    ApiDetails List<CustomHsmCertificateApiDetail>
    The details of the API in Fortanix
    CustomHsmCertificateId string
    InputHash string
    Currently ignored. If pulumi preview flags this field as changed, it means that any of: certificate, site_id, or api_detail has changed.
    Certificate string
    The certificate file in base64 format.
    SiteId string
    Numeric identifier of the site to operate on.
    ApiDetails []CustomHsmCertificateApiDetailArgs
    The details of the API in Fortanix
    CustomHsmCertificateId string
    InputHash string
    Currently ignored. If pulumi preview flags this field as changed, it means that any of: certificate, site_id, or api_detail has changed.
    certificate String
    The certificate file in base64 format.
    siteId String
    Numeric identifier of the site to operate on.
    apiDetails List<CustomHsmCertificateApiDetail>
    The details of the API in Fortanix
    customHsmCertificateId String
    inputHash String
    Currently ignored. If pulumi preview flags this field as changed, it means that any of: certificate, site_id, or api_detail has changed.
    certificate string
    The certificate file in base64 format.
    siteId string
    Numeric identifier of the site to operate on.
    apiDetails CustomHsmCertificateApiDetail[]
    The details of the API in Fortanix
    customHsmCertificateId string
    inputHash string
    Currently ignored. If pulumi preview flags this field as changed, it means that any of: certificate, site_id, or api_detail has changed.
    certificate str
    The certificate file in base64 format.
    site_id str
    Numeric identifier of the site to operate on.
    api_details Sequence[CustomHsmCertificateApiDetailArgs]
    The details of the API in Fortanix
    custom_hsm_certificate_id str
    input_hash str
    Currently ignored. If pulumi preview flags this field as changed, it means that any of: certificate, site_id, or api_detail has changed.
    certificate String
    The certificate file in base64 format.
    siteId String
    Numeric identifier of the site to operate on.
    apiDetails List<Property Map>
    The details of the API in Fortanix
    customHsmCertificateId String
    inputHash String
    Currently ignored. If pulumi preview flags this field as changed, it means that any of: certificate, site_id, or api_detail has changed.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the CustomHsmCertificate 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 CustomHsmCertificate Resource

    Get an existing CustomHsmCertificate 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?: CustomHsmCertificateState, opts?: CustomResourceOptions): CustomHsmCertificate
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            api_details: Optional[Sequence[CustomHsmCertificateApiDetailArgs]] = None,
            certificate: Optional[str] = None,
            custom_hsm_certificate_id: Optional[str] = None,
            input_hash: Optional[str] = None,
            site_id: Optional[str] = None) -> CustomHsmCertificate
    func GetCustomHsmCertificate(ctx *Context, name string, id IDInput, state *CustomHsmCertificateState, opts ...ResourceOption) (*CustomHsmCertificate, error)
    public static CustomHsmCertificate Get(string name, Input<string> id, CustomHsmCertificateState? state, CustomResourceOptions? opts = null)
    public static CustomHsmCertificate get(String name, Output<String> id, CustomHsmCertificateState state, CustomResourceOptions options)
    resources:  _:    type: incapsula:CustomHsmCertificate    get:      id: ${id}
    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:
    ApiDetails List<CustomHsmCertificateApiDetail>
    The details of the API in Fortanix
    Certificate string
    The certificate file in base64 format.
    CustomHsmCertificateId string
    InputHash string
    Currently ignored. If pulumi preview flags this field as changed, it means that any of: certificate, site_id, or api_detail has changed.
    SiteId string
    Numeric identifier of the site to operate on.
    ApiDetails []CustomHsmCertificateApiDetailArgs
    The details of the API in Fortanix
    Certificate string
    The certificate file in base64 format.
    CustomHsmCertificateId string
    InputHash string
    Currently ignored. If pulumi preview flags this field as changed, it means that any of: certificate, site_id, or api_detail has changed.
    SiteId string
    Numeric identifier of the site to operate on.
    apiDetails List<CustomHsmCertificateApiDetail>
    The details of the API in Fortanix
    certificate String
    The certificate file in base64 format.
    customHsmCertificateId String
    inputHash String
    Currently ignored. If pulumi preview flags this field as changed, it means that any of: certificate, site_id, or api_detail has changed.
    siteId String
    Numeric identifier of the site to operate on.
    apiDetails CustomHsmCertificateApiDetail[]
    The details of the API in Fortanix
    certificate string
    The certificate file in base64 format.
    customHsmCertificateId string
    inputHash string
    Currently ignored. If pulumi preview flags this field as changed, it means that any of: certificate, site_id, or api_detail has changed.
    siteId string
    Numeric identifier of the site to operate on.
    api_details Sequence[CustomHsmCertificateApiDetailArgs]
    The details of the API in Fortanix
    certificate str
    The certificate file in base64 format.
    custom_hsm_certificate_id str
    input_hash str
    Currently ignored. If pulumi preview flags this field as changed, it means that any of: certificate, site_id, or api_detail has changed.
    site_id str
    Numeric identifier of the site to operate on.
    apiDetails List<Property Map>
    The details of the API in Fortanix
    certificate String
    The certificate file in base64 format.
    customHsmCertificateId String
    inputHash String
    Currently ignored. If pulumi preview flags this field as changed, it means that any of: certificate, site_id, or api_detail has changed.
    siteId String
    Numeric identifier of the site to operate on.

    Supporting Types

    CustomHsmCertificateApiDetail, CustomHsmCertificateApiDetailArgs

    ApiId string
    The key ID. This is the UUID of the Fortanix security object.
    ApiKey string
    The API key. This is the REST API authentication key from the Fortanix application you created.
    Hostname string
    The hostname. This is the location of your assets in the HSM service. In this case, it's the URI (host name) of the Fortanix region as it appears in the security object. For example, api.amer.smartkey.io.
    ApiId string
    The key ID. This is the UUID of the Fortanix security object.
    ApiKey string
    The API key. This is the REST API authentication key from the Fortanix application you created.
    Hostname string
    The hostname. This is the location of your assets in the HSM service. In this case, it's the URI (host name) of the Fortanix region as it appears in the security object. For example, api.amer.smartkey.io.
    apiId String
    The key ID. This is the UUID of the Fortanix security object.
    apiKey String
    The API key. This is the REST API authentication key from the Fortanix application you created.
    hostname String
    The hostname. This is the location of your assets in the HSM service. In this case, it's the URI (host name) of the Fortanix region as it appears in the security object. For example, api.amer.smartkey.io.
    apiId string
    The key ID. This is the UUID of the Fortanix security object.
    apiKey string
    The API key. This is the REST API authentication key from the Fortanix application you created.
    hostname string
    The hostname. This is the location of your assets in the HSM service. In this case, it's the URI (host name) of the Fortanix region as it appears in the security object. For example, api.amer.smartkey.io.
    api_id str
    The key ID. This is the UUID of the Fortanix security object.
    api_key str
    The API key. This is the REST API authentication key from the Fortanix application you created.
    hostname str
    The hostname. This is the location of your assets in the HSM service. In this case, it's the URI (host name) of the Fortanix region as it appears in the security object. For example, api.amer.smartkey.io.
    apiId String
    The key ID. This is the UUID of the Fortanix security object.
    apiKey String
    The API key. This is the REST API authentication key from the Fortanix application you created.
    hostname String
    The hostname. This is the location of your assets in the HSM service. In this case, it's the URI (host name) of the Fortanix region as it appears in the security object. For example, api.amer.smartkey.io.

    Import

    Custom HSM Certificate cannot be imported.

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

    Package Details

    Repository
    incapsula imperva/terraform-provider-incapsula
    License
    Notes
    This Pulumi package is based on the incapsula Terraform Provider.
    incapsula logo
    incapsula 3.33.0 published on Wednesday, Apr 30, 2025 by imperva