1. Packages
  2. AWS
  3. API Docs
  4. cloudhsmv2
  5. Hsm
AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi

aws.cloudhsmv2.Hsm

Explore with Pulumi AI

aws logo
AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi

    Creates an HSM module in Amazon CloudHSM v2 cluster.

    Example Usage

    The following example below creates an HSM module in CloudHSM cluster.

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const cluster = aws.cloudhsmv2.getCluster({
        clusterId: cloudhsmClusterId,
    });
    const cloudhsmV2Hsm = new aws.cloudhsmv2.Hsm("cloudhsm_v2_hsm", {
        subnetId: cluster.then(cluster => cluster.subnetIds?.[0]),
        clusterId: cluster.then(cluster => cluster.clusterId),
    });
    
    import pulumi
    import pulumi_aws as aws
    
    cluster = aws.cloudhsmv2.get_cluster(cluster_id=cloudhsm_cluster_id)
    cloudhsm_v2_hsm = aws.cloudhsmv2.Hsm("cloudhsm_v2_hsm",
        subnet_id=cluster.subnet_ids[0],
        cluster_id=cluster.cluster_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudhsmv2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cluster, err := cloudhsmv2.LookupCluster(ctx, &cloudhsmv2.LookupClusterArgs{
    			ClusterId: cloudhsmClusterId,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = cloudhsmv2.NewHsm(ctx, "cloudhsm_v2_hsm", &cloudhsmv2.HsmArgs{
    			SubnetId:  pulumi.String(cluster.SubnetIds[0]),
    			ClusterId: pulumi.String(cluster.ClusterId),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var cluster = Aws.CloudHsmV2.GetCluster.Invoke(new()
        {
            ClusterId = cloudhsmClusterId,
        });
    
        var cloudhsmV2Hsm = new Aws.CloudHsmV2.Hsm("cloudhsm_v2_hsm", new()
        {
            SubnetId = cluster.Apply(getClusterResult => getClusterResult.SubnetIds[0]),
            ClusterId = cluster.Apply(getClusterResult => getClusterResult.ClusterId),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.cloudhsmv2.Cloudhsmv2Functions;
    import com.pulumi.aws.cloudhsmv2.inputs.GetClusterArgs;
    import com.pulumi.aws.cloudhsmv2.Hsm;
    import com.pulumi.aws.cloudhsmv2.HsmArgs;
    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) {
            final var cluster = Cloudhsmv2Functions.getCluster(GetClusterArgs.builder()
                .clusterId(cloudhsmClusterId)
                .build());
    
            var cloudhsmV2Hsm = new Hsm("cloudhsmV2Hsm", HsmArgs.builder()
                .subnetId(cluster.applyValue(getClusterResult -> getClusterResult.subnetIds()[0]))
                .clusterId(cluster.applyValue(getClusterResult -> getClusterResult.clusterId()))
                .build());
    
        }
    }
    
    resources:
      cloudhsmV2Hsm:
        type: aws:cloudhsmv2:Hsm
        name: cloudhsm_v2_hsm
        properties:
          subnetId: ${cluster.subnetIds[0]}
          clusterId: ${cluster.clusterId}
    variables:
      cluster:
        fn::invoke:
          Function: aws:cloudhsmv2:getCluster
          Arguments:
            clusterId: ${cloudhsmClusterId}
    

    Create Hsm Resource

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

    Constructor syntax

    new Hsm(name: string, args: HsmArgs, opts?: CustomResourceOptions);
    @overload
    def Hsm(resource_name: str,
            args: HsmArgs,
            opts: Optional[ResourceOptions] = None)
    
    @overload
    def Hsm(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            cluster_id: Optional[str] = None,
            availability_zone: Optional[str] = None,
            ip_address: Optional[str] = None,
            subnet_id: Optional[str] = None)
    func NewHsm(ctx *Context, name string, args HsmArgs, opts ...ResourceOption) (*Hsm, error)
    public Hsm(string name, HsmArgs args, CustomResourceOptions? opts = null)
    public Hsm(String name, HsmArgs args)
    public Hsm(String name, HsmArgs args, CustomResourceOptions options)
    
    type: aws:cloudhsmv2:Hsm
    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 HsmArgs
    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 HsmArgs
    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 HsmArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args HsmArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args HsmArgs
    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 hsmResource = new Aws.CloudHsmV2.Hsm("hsmResource", new()
    {
        ClusterId = "string",
        AvailabilityZone = "string",
        IpAddress = "string",
        SubnetId = "string",
    });
    
    example, err := cloudhsmv2.NewHsm(ctx, "hsmResource", &cloudhsmv2.HsmArgs{
    	ClusterId:        pulumi.String("string"),
    	AvailabilityZone: pulumi.String("string"),
    	IpAddress:        pulumi.String("string"),
    	SubnetId:         pulumi.String("string"),
    })
    
    var hsmResource = new Hsm("hsmResource", HsmArgs.builder()
        .clusterId("string")
        .availabilityZone("string")
        .ipAddress("string")
        .subnetId("string")
        .build());
    
    hsm_resource = aws.cloudhsmv2.Hsm("hsmResource",
        cluster_id="string",
        availability_zone="string",
        ip_address="string",
        subnet_id="string")
    
    const hsmResource = new aws.cloudhsmv2.Hsm("hsmResource", {
        clusterId: "string",
        availabilityZone: "string",
        ipAddress: "string",
        subnetId: "string",
    });
    
    type: aws:cloudhsmv2:Hsm
    properties:
        availabilityZone: string
        clusterId: string
        ipAddress: string
        subnetId: string
    

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

    ClusterId string
    The ID of Cloud HSM v2 cluster to which HSM will be added.
    AvailabilityZone string
    The IDs of AZ in which HSM module will be located. Conflicts with subnet_id.
    IpAddress string
    The IP address of HSM module. Must be within the CIDR of selected subnet.
    SubnetId string
    The ID of subnet in which HSM module will be located. Conflicts with availability_zone.
    ClusterId string
    The ID of Cloud HSM v2 cluster to which HSM will be added.
    AvailabilityZone string
    The IDs of AZ in which HSM module will be located. Conflicts with subnet_id.
    IpAddress string
    The IP address of HSM module. Must be within the CIDR of selected subnet.
    SubnetId string
    The ID of subnet in which HSM module will be located. Conflicts with availability_zone.
    clusterId String
    The ID of Cloud HSM v2 cluster to which HSM will be added.
    availabilityZone String
    The IDs of AZ in which HSM module will be located. Conflicts with subnet_id.
    ipAddress String
    The IP address of HSM module. Must be within the CIDR of selected subnet.
    subnetId String
    The ID of subnet in which HSM module will be located. Conflicts with availability_zone.
    clusterId string
    The ID of Cloud HSM v2 cluster to which HSM will be added.
    availabilityZone string
    The IDs of AZ in which HSM module will be located. Conflicts with subnet_id.
    ipAddress string
    The IP address of HSM module. Must be within the CIDR of selected subnet.
    subnetId string
    The ID of subnet in which HSM module will be located. Conflicts with availability_zone.
    cluster_id str
    The ID of Cloud HSM v2 cluster to which HSM will be added.
    availability_zone str
    The IDs of AZ in which HSM module will be located. Conflicts with subnet_id.
    ip_address str
    The IP address of HSM module. Must be within the CIDR of selected subnet.
    subnet_id str
    The ID of subnet in which HSM module will be located. Conflicts with availability_zone.
    clusterId String
    The ID of Cloud HSM v2 cluster to which HSM will be added.
    availabilityZone String
    The IDs of AZ in which HSM module will be located. Conflicts with subnet_id.
    ipAddress String
    The IP address of HSM module. Must be within the CIDR of selected subnet.
    subnetId String
    The ID of subnet in which HSM module will be located. Conflicts with availability_zone.

    Outputs

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

    HsmEniId string
    The id of the ENI interface allocated for HSM module.
    HsmId string
    The id of the HSM module.
    Id string
    The provider-assigned unique ID for this managed resource.
    State string
    The state of the HSM module.
    HsmEniId string
    The id of the ENI interface allocated for HSM module.
    HsmId string
    The id of the HSM module.
    HsmState string
    The state of the HSM module.
    Id string
    The provider-assigned unique ID for this managed resource.
    hsmEniId String
    The id of the ENI interface allocated for HSM module.
    hsmId String
    The id of the HSM module.
    hsmState String
    The state of the HSM module.
    id String
    The provider-assigned unique ID for this managed resource.
    hsmEniId string
    The id of the ENI interface allocated for HSM module.
    hsmId string
    The id of the HSM module.
    hsmState string
    The state of the HSM module.
    id string
    The provider-assigned unique ID for this managed resource.
    hsm_eni_id str
    The id of the ENI interface allocated for HSM module.
    hsm_id str
    The id of the HSM module.
    hsm_state str
    The state of the HSM module.
    id str
    The provider-assigned unique ID for this managed resource.
    hsmEniId String
    The id of the ENI interface allocated for HSM module.
    hsmId String
    The id of the HSM module.
    hsmState String
    The state of the HSM module.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Hsm Resource

    Get an existing Hsm 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?: HsmState, opts?: CustomResourceOptions): Hsm
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            availability_zone: Optional[str] = None,
            cluster_id: Optional[str] = None,
            hsm_eni_id: Optional[str] = None,
            hsm_id: Optional[str] = None,
            hsm_state: Optional[str] = None,
            ip_address: Optional[str] = None,
            subnet_id: Optional[str] = None) -> Hsm
    func GetHsm(ctx *Context, name string, id IDInput, state *HsmState, opts ...ResourceOption) (*Hsm, error)
    public static Hsm Get(string name, Input<string> id, HsmState? state, CustomResourceOptions? opts = null)
    public static Hsm get(String name, Output<String> id, HsmState 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:
    AvailabilityZone string
    The IDs of AZ in which HSM module will be located. Conflicts with subnet_id.
    ClusterId string
    The ID of Cloud HSM v2 cluster to which HSM will be added.
    HsmEniId string
    The id of the ENI interface allocated for HSM module.
    HsmId string
    The id of the HSM module.
    IpAddress string
    The IP address of HSM module. Must be within the CIDR of selected subnet.
    State string
    The state of the HSM module.
    SubnetId string
    The ID of subnet in which HSM module will be located. Conflicts with availability_zone.
    AvailabilityZone string
    The IDs of AZ in which HSM module will be located. Conflicts with subnet_id.
    ClusterId string
    The ID of Cloud HSM v2 cluster to which HSM will be added.
    HsmEniId string
    The id of the ENI interface allocated for HSM module.
    HsmId string
    The id of the HSM module.
    HsmState string
    The state of the HSM module.
    IpAddress string
    The IP address of HSM module. Must be within the CIDR of selected subnet.
    SubnetId string
    The ID of subnet in which HSM module will be located. Conflicts with availability_zone.
    availabilityZone String
    The IDs of AZ in which HSM module will be located. Conflicts with subnet_id.
    clusterId String
    The ID of Cloud HSM v2 cluster to which HSM will be added.
    hsmEniId String
    The id of the ENI interface allocated for HSM module.
    hsmId String
    The id of the HSM module.
    hsmState String
    The state of the HSM module.
    ipAddress String
    The IP address of HSM module. Must be within the CIDR of selected subnet.
    subnetId String
    The ID of subnet in which HSM module will be located. Conflicts with availability_zone.
    availabilityZone string
    The IDs of AZ in which HSM module will be located. Conflicts with subnet_id.
    clusterId string
    The ID of Cloud HSM v2 cluster to which HSM will be added.
    hsmEniId string
    The id of the ENI interface allocated for HSM module.
    hsmId string
    The id of the HSM module.
    hsmState string
    The state of the HSM module.
    ipAddress string
    The IP address of HSM module. Must be within the CIDR of selected subnet.
    subnetId string
    The ID of subnet in which HSM module will be located. Conflicts with availability_zone.
    availability_zone str
    The IDs of AZ in which HSM module will be located. Conflicts with subnet_id.
    cluster_id str
    The ID of Cloud HSM v2 cluster to which HSM will be added.
    hsm_eni_id str
    The id of the ENI interface allocated for HSM module.
    hsm_id str
    The id of the HSM module.
    hsm_state str
    The state of the HSM module.
    ip_address str
    The IP address of HSM module. Must be within the CIDR of selected subnet.
    subnet_id str
    The ID of subnet in which HSM module will be located. Conflicts with availability_zone.
    availabilityZone String
    The IDs of AZ in which HSM module will be located. Conflicts with subnet_id.
    clusterId String
    The ID of Cloud HSM v2 cluster to which HSM will be added.
    hsmEniId String
    The id of the ENI interface allocated for HSM module.
    hsmId String
    The id of the HSM module.
    hsmState String
    The state of the HSM module.
    ipAddress String
    The IP address of HSM module. Must be within the CIDR of selected subnet.
    subnetId String
    The ID of subnet in which HSM module will be located. Conflicts with availability_zone.

    Import

    Using pulumi import, import HSM modules using their HSM ID. For example:

    $ pulumi import aws:cloudhsmv2/hsm:Hsm bar hsm-quo8dahtaca
    

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

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi