github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/kms/customKeyStore.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package kms
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Resource for managing an AWS KMS (Key Management) Custom Key Store.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Basic Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kms"
    28  //	"github.com/pulumi/pulumi-std/sdk/go/std"
    29  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    30  //
    31  // )
    32  //
    33  //	func main() {
    34  //		pulumi.Run(func(ctx *pulumi.Context) error {
    35  //			invokeFile, err := std.File(ctx, &std.FileArgs{
    36  //				Input: "anchor-certificate.crt",
    37  //			}, nil)
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			_, err = kms.NewCustomKeyStore(ctx, "test", &kms.CustomKeyStoreArgs{
    42  //				CloudHsmClusterId:      pulumi.Any(cloudHsmClusterId),
    43  //				CustomKeyStoreName:     pulumi.String("kms-custom-key-store-test"),
    44  //				KeyStorePassword:       pulumi.String("noplaintextpasswords1"),
    45  //				TrustAnchorCertificate: invokeFile.Result,
    46  //			})
    47  //			if err != nil {
    48  //				return err
    49  //			}
    50  //			return nil
    51  //		})
    52  //	}
    53  //
    54  // ```
    55  // <!--End PulumiCodeChooser -->
    56  //
    57  // ## Import
    58  //
    59  // Using `pulumi import`, import KMS (Key Management) Custom Key Store using the `id`. For example:
    60  //
    61  // ```sh
    62  // $ pulumi import aws:kms/customKeyStore:CustomKeyStore example cks-5ebd4ef395a96288e
    63  // ```
    64  type CustomKeyStore struct {
    65  	pulumi.CustomResourceState
    66  
    67  	// Cluster ID of CloudHSM.
    68  	CloudHsmClusterId pulumi.StringOutput `pulumi:"cloudHsmClusterId"`
    69  	// Unique name for Custom Key Store.
    70  	CustomKeyStoreName pulumi.StringOutput `pulumi:"customKeyStoreName"`
    71  	// Password for `kmsuser` on CloudHSM.
    72  	KeyStorePassword pulumi.StringOutput `pulumi:"keyStorePassword"`
    73  	// Customer certificate used for signing on CloudHSM.
    74  	TrustAnchorCertificate pulumi.StringOutput `pulumi:"trustAnchorCertificate"`
    75  }
    76  
    77  // NewCustomKeyStore registers a new resource with the given unique name, arguments, and options.
    78  func NewCustomKeyStore(ctx *pulumi.Context,
    79  	name string, args *CustomKeyStoreArgs, opts ...pulumi.ResourceOption) (*CustomKeyStore, error) {
    80  	if args == nil {
    81  		return nil, errors.New("missing one or more required arguments")
    82  	}
    83  
    84  	if args.CloudHsmClusterId == nil {
    85  		return nil, errors.New("invalid value for required argument 'CloudHsmClusterId'")
    86  	}
    87  	if args.CustomKeyStoreName == nil {
    88  		return nil, errors.New("invalid value for required argument 'CustomKeyStoreName'")
    89  	}
    90  	if args.KeyStorePassword == nil {
    91  		return nil, errors.New("invalid value for required argument 'KeyStorePassword'")
    92  	}
    93  	if args.TrustAnchorCertificate == nil {
    94  		return nil, errors.New("invalid value for required argument 'TrustAnchorCertificate'")
    95  	}
    96  	opts = internal.PkgResourceDefaultOpts(opts)
    97  	var resource CustomKeyStore
    98  	err := ctx.RegisterResource("aws:kms/customKeyStore:CustomKeyStore", name, args, &resource, opts...)
    99  	if err != nil {
   100  		return nil, err
   101  	}
   102  	return &resource, nil
   103  }
   104  
   105  // GetCustomKeyStore gets an existing CustomKeyStore resource's state with the given name, ID, and optional
   106  // state properties that are used to uniquely qualify the lookup (nil if not required).
   107  func GetCustomKeyStore(ctx *pulumi.Context,
   108  	name string, id pulumi.IDInput, state *CustomKeyStoreState, opts ...pulumi.ResourceOption) (*CustomKeyStore, error) {
   109  	var resource CustomKeyStore
   110  	err := ctx.ReadResource("aws:kms/customKeyStore:CustomKeyStore", name, id, state, &resource, opts...)
   111  	if err != nil {
   112  		return nil, err
   113  	}
   114  	return &resource, nil
   115  }
   116  
   117  // Input properties used for looking up and filtering CustomKeyStore resources.
   118  type customKeyStoreState struct {
   119  	// Cluster ID of CloudHSM.
   120  	CloudHsmClusterId *string `pulumi:"cloudHsmClusterId"`
   121  	// Unique name for Custom Key Store.
   122  	CustomKeyStoreName *string `pulumi:"customKeyStoreName"`
   123  	// Password for `kmsuser` on CloudHSM.
   124  	KeyStorePassword *string `pulumi:"keyStorePassword"`
   125  	// Customer certificate used for signing on CloudHSM.
   126  	TrustAnchorCertificate *string `pulumi:"trustAnchorCertificate"`
   127  }
   128  
   129  type CustomKeyStoreState struct {
   130  	// Cluster ID of CloudHSM.
   131  	CloudHsmClusterId pulumi.StringPtrInput
   132  	// Unique name for Custom Key Store.
   133  	CustomKeyStoreName pulumi.StringPtrInput
   134  	// Password for `kmsuser` on CloudHSM.
   135  	KeyStorePassword pulumi.StringPtrInput
   136  	// Customer certificate used for signing on CloudHSM.
   137  	TrustAnchorCertificate pulumi.StringPtrInput
   138  }
   139  
   140  func (CustomKeyStoreState) ElementType() reflect.Type {
   141  	return reflect.TypeOf((*customKeyStoreState)(nil)).Elem()
   142  }
   143  
   144  type customKeyStoreArgs struct {
   145  	// Cluster ID of CloudHSM.
   146  	CloudHsmClusterId string `pulumi:"cloudHsmClusterId"`
   147  	// Unique name for Custom Key Store.
   148  	CustomKeyStoreName string `pulumi:"customKeyStoreName"`
   149  	// Password for `kmsuser` on CloudHSM.
   150  	KeyStorePassword string `pulumi:"keyStorePassword"`
   151  	// Customer certificate used for signing on CloudHSM.
   152  	TrustAnchorCertificate string `pulumi:"trustAnchorCertificate"`
   153  }
   154  
   155  // The set of arguments for constructing a CustomKeyStore resource.
   156  type CustomKeyStoreArgs struct {
   157  	// Cluster ID of CloudHSM.
   158  	CloudHsmClusterId pulumi.StringInput
   159  	// Unique name for Custom Key Store.
   160  	CustomKeyStoreName pulumi.StringInput
   161  	// Password for `kmsuser` on CloudHSM.
   162  	KeyStorePassword pulumi.StringInput
   163  	// Customer certificate used for signing on CloudHSM.
   164  	TrustAnchorCertificate pulumi.StringInput
   165  }
   166  
   167  func (CustomKeyStoreArgs) ElementType() reflect.Type {
   168  	return reflect.TypeOf((*customKeyStoreArgs)(nil)).Elem()
   169  }
   170  
   171  type CustomKeyStoreInput interface {
   172  	pulumi.Input
   173  
   174  	ToCustomKeyStoreOutput() CustomKeyStoreOutput
   175  	ToCustomKeyStoreOutputWithContext(ctx context.Context) CustomKeyStoreOutput
   176  }
   177  
   178  func (*CustomKeyStore) ElementType() reflect.Type {
   179  	return reflect.TypeOf((**CustomKeyStore)(nil)).Elem()
   180  }
   181  
   182  func (i *CustomKeyStore) ToCustomKeyStoreOutput() CustomKeyStoreOutput {
   183  	return i.ToCustomKeyStoreOutputWithContext(context.Background())
   184  }
   185  
   186  func (i *CustomKeyStore) ToCustomKeyStoreOutputWithContext(ctx context.Context) CustomKeyStoreOutput {
   187  	return pulumi.ToOutputWithContext(ctx, i).(CustomKeyStoreOutput)
   188  }
   189  
   190  // CustomKeyStoreArrayInput is an input type that accepts CustomKeyStoreArray and CustomKeyStoreArrayOutput values.
   191  // You can construct a concrete instance of `CustomKeyStoreArrayInput` via:
   192  //
   193  //	CustomKeyStoreArray{ CustomKeyStoreArgs{...} }
   194  type CustomKeyStoreArrayInput interface {
   195  	pulumi.Input
   196  
   197  	ToCustomKeyStoreArrayOutput() CustomKeyStoreArrayOutput
   198  	ToCustomKeyStoreArrayOutputWithContext(context.Context) CustomKeyStoreArrayOutput
   199  }
   200  
   201  type CustomKeyStoreArray []CustomKeyStoreInput
   202  
   203  func (CustomKeyStoreArray) ElementType() reflect.Type {
   204  	return reflect.TypeOf((*[]*CustomKeyStore)(nil)).Elem()
   205  }
   206  
   207  func (i CustomKeyStoreArray) ToCustomKeyStoreArrayOutput() CustomKeyStoreArrayOutput {
   208  	return i.ToCustomKeyStoreArrayOutputWithContext(context.Background())
   209  }
   210  
   211  func (i CustomKeyStoreArray) ToCustomKeyStoreArrayOutputWithContext(ctx context.Context) CustomKeyStoreArrayOutput {
   212  	return pulumi.ToOutputWithContext(ctx, i).(CustomKeyStoreArrayOutput)
   213  }
   214  
   215  // CustomKeyStoreMapInput is an input type that accepts CustomKeyStoreMap and CustomKeyStoreMapOutput values.
   216  // You can construct a concrete instance of `CustomKeyStoreMapInput` via:
   217  //
   218  //	CustomKeyStoreMap{ "key": CustomKeyStoreArgs{...} }
   219  type CustomKeyStoreMapInput interface {
   220  	pulumi.Input
   221  
   222  	ToCustomKeyStoreMapOutput() CustomKeyStoreMapOutput
   223  	ToCustomKeyStoreMapOutputWithContext(context.Context) CustomKeyStoreMapOutput
   224  }
   225  
   226  type CustomKeyStoreMap map[string]CustomKeyStoreInput
   227  
   228  func (CustomKeyStoreMap) ElementType() reflect.Type {
   229  	return reflect.TypeOf((*map[string]*CustomKeyStore)(nil)).Elem()
   230  }
   231  
   232  func (i CustomKeyStoreMap) ToCustomKeyStoreMapOutput() CustomKeyStoreMapOutput {
   233  	return i.ToCustomKeyStoreMapOutputWithContext(context.Background())
   234  }
   235  
   236  func (i CustomKeyStoreMap) ToCustomKeyStoreMapOutputWithContext(ctx context.Context) CustomKeyStoreMapOutput {
   237  	return pulumi.ToOutputWithContext(ctx, i).(CustomKeyStoreMapOutput)
   238  }
   239  
   240  type CustomKeyStoreOutput struct{ *pulumi.OutputState }
   241  
   242  func (CustomKeyStoreOutput) ElementType() reflect.Type {
   243  	return reflect.TypeOf((**CustomKeyStore)(nil)).Elem()
   244  }
   245  
   246  func (o CustomKeyStoreOutput) ToCustomKeyStoreOutput() CustomKeyStoreOutput {
   247  	return o
   248  }
   249  
   250  func (o CustomKeyStoreOutput) ToCustomKeyStoreOutputWithContext(ctx context.Context) CustomKeyStoreOutput {
   251  	return o
   252  }
   253  
   254  // Cluster ID of CloudHSM.
   255  func (o CustomKeyStoreOutput) CloudHsmClusterId() pulumi.StringOutput {
   256  	return o.ApplyT(func(v *CustomKeyStore) pulumi.StringOutput { return v.CloudHsmClusterId }).(pulumi.StringOutput)
   257  }
   258  
   259  // Unique name for Custom Key Store.
   260  func (o CustomKeyStoreOutput) CustomKeyStoreName() pulumi.StringOutput {
   261  	return o.ApplyT(func(v *CustomKeyStore) pulumi.StringOutput { return v.CustomKeyStoreName }).(pulumi.StringOutput)
   262  }
   263  
   264  // Password for `kmsuser` on CloudHSM.
   265  func (o CustomKeyStoreOutput) KeyStorePassword() pulumi.StringOutput {
   266  	return o.ApplyT(func(v *CustomKeyStore) pulumi.StringOutput { return v.KeyStorePassword }).(pulumi.StringOutput)
   267  }
   268  
   269  // Customer certificate used for signing on CloudHSM.
   270  func (o CustomKeyStoreOutput) TrustAnchorCertificate() pulumi.StringOutput {
   271  	return o.ApplyT(func(v *CustomKeyStore) pulumi.StringOutput { return v.TrustAnchorCertificate }).(pulumi.StringOutput)
   272  }
   273  
   274  type CustomKeyStoreArrayOutput struct{ *pulumi.OutputState }
   275  
   276  func (CustomKeyStoreArrayOutput) ElementType() reflect.Type {
   277  	return reflect.TypeOf((*[]*CustomKeyStore)(nil)).Elem()
   278  }
   279  
   280  func (o CustomKeyStoreArrayOutput) ToCustomKeyStoreArrayOutput() CustomKeyStoreArrayOutput {
   281  	return o
   282  }
   283  
   284  func (o CustomKeyStoreArrayOutput) ToCustomKeyStoreArrayOutputWithContext(ctx context.Context) CustomKeyStoreArrayOutput {
   285  	return o
   286  }
   287  
   288  func (o CustomKeyStoreArrayOutput) Index(i pulumi.IntInput) CustomKeyStoreOutput {
   289  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *CustomKeyStore {
   290  		return vs[0].([]*CustomKeyStore)[vs[1].(int)]
   291  	}).(CustomKeyStoreOutput)
   292  }
   293  
   294  type CustomKeyStoreMapOutput struct{ *pulumi.OutputState }
   295  
   296  func (CustomKeyStoreMapOutput) ElementType() reflect.Type {
   297  	return reflect.TypeOf((*map[string]*CustomKeyStore)(nil)).Elem()
   298  }
   299  
   300  func (o CustomKeyStoreMapOutput) ToCustomKeyStoreMapOutput() CustomKeyStoreMapOutput {
   301  	return o
   302  }
   303  
   304  func (o CustomKeyStoreMapOutput) ToCustomKeyStoreMapOutputWithContext(ctx context.Context) CustomKeyStoreMapOutput {
   305  	return o
   306  }
   307  
   308  func (o CustomKeyStoreMapOutput) MapIndex(k pulumi.StringInput) CustomKeyStoreOutput {
   309  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *CustomKeyStore {
   310  		return vs[0].(map[string]*CustomKeyStore)[vs[1].(string)]
   311  	}).(CustomKeyStoreOutput)
   312  }
   313  
   314  func init() {
   315  	pulumi.RegisterInputType(reflect.TypeOf((*CustomKeyStoreInput)(nil)).Elem(), &CustomKeyStore{})
   316  	pulumi.RegisterInputType(reflect.TypeOf((*CustomKeyStoreArrayInput)(nil)).Elem(), CustomKeyStoreArray{})
   317  	pulumi.RegisterInputType(reflect.TypeOf((*CustomKeyStoreMapInput)(nil)).Elem(), CustomKeyStoreMap{})
   318  	pulumi.RegisterOutputType(CustomKeyStoreOutput{})
   319  	pulumi.RegisterOutputType(CustomKeyStoreArrayOutput{})
   320  	pulumi.RegisterOutputType(CustomKeyStoreMapOutput{})
   321  }