github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/rolesanywhere/trustAnchor.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 rolesanywhere
     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 a Roles Anywhere Trust Anchor.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"fmt"
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
    28  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/acmpca"
    29  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/rolesanywhere"
    30  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    31  //
    32  // )
    33  //
    34  //	func main() {
    35  //		pulumi.Run(func(ctx *pulumi.Context) error {
    36  //			example, err := acmpca.NewCertificateAuthority(ctx, "example", &acmpca.CertificateAuthorityArgs{
    37  //				PermanentDeletionTimeInDays: pulumi.Int(7),
    38  //				Type:                        pulumi.String("ROOT"),
    39  //				CertificateAuthorityConfiguration: &acmpca.CertificateAuthorityCertificateAuthorityConfigurationArgs{
    40  //					KeyAlgorithm:     pulumi.String("RSA_4096"),
    41  //					SigningAlgorithm: pulumi.String("SHA512WITHRSA"),
    42  //					Subject: &acmpca.CertificateAuthorityCertificateAuthorityConfigurationSubjectArgs{
    43  //						CommonName: pulumi.String("example.com"),
    44  //					},
    45  //				},
    46  //			})
    47  //			if err != nil {
    48  //				return err
    49  //			}
    50  //			current, err := aws.GetPartition(ctx, nil, nil)
    51  //			if err != nil {
    52  //				return err
    53  //			}
    54  //			_, err = acmpca.NewCertificate(ctx, "test", &acmpca.CertificateArgs{
    55  //				CertificateAuthorityArn:   example.Arn,
    56  //				CertificateSigningRequest: example.CertificateSigningRequest,
    57  //				SigningAlgorithm:          pulumi.String("SHA512WITHRSA"),
    58  //				TemplateArn:               pulumi.String(fmt.Sprintf("arn:%v:acm-pca:::template/RootCACertificate/V1", current.Partition)),
    59  //				Validity: &acmpca.CertificateValidityArgs{
    60  //					Type:  pulumi.String("YEARS"),
    61  //					Value: pulumi.String("1"),
    62  //				},
    63  //			})
    64  //			if err != nil {
    65  //				return err
    66  //			}
    67  //			exampleCertificateAuthorityCertificate, err := acmpca.NewCertificateAuthorityCertificate(ctx, "example", &acmpca.CertificateAuthorityCertificateArgs{
    68  //				CertificateAuthorityArn: example.Arn,
    69  //				Certificate:             pulumi.Any(exampleAwsAcmpcaCertificate.Certificate),
    70  //				CertificateChain:        pulumi.Any(exampleAwsAcmpcaCertificate.CertificateChain),
    71  //			})
    72  //			if err != nil {
    73  //				return err
    74  //			}
    75  //			_, err = rolesanywhere.NewTrustAnchor(ctx, "test", &rolesanywhere.TrustAnchorArgs{
    76  //				Name: pulumi.String("example"),
    77  //				Source: &rolesanywhere.TrustAnchorSourceArgs{
    78  //					SourceData: &rolesanywhere.TrustAnchorSourceSourceDataArgs{
    79  //						AcmPcaArn: example.Arn,
    80  //					},
    81  //					SourceType: pulumi.String("AWS_ACM_PCA"),
    82  //				},
    83  //			}, pulumi.DependsOn([]pulumi.Resource{
    84  //				exampleCertificateAuthorityCertificate,
    85  //			}))
    86  //			if err != nil {
    87  //				return err
    88  //			}
    89  //			return nil
    90  //		})
    91  //	}
    92  //
    93  // ```
    94  // <!--End PulumiCodeChooser -->
    95  //
    96  // ## Import
    97  //
    98  // Using `pulumi import`, import `aws_rolesanywhere_trust_anchor` using its `id`. For example:
    99  //
   100  // ```sh
   101  // $ pulumi import aws:rolesanywhere/trustAnchor:TrustAnchor example 92b2fbbb-984d-41a3-a765-e3cbdb69ebb1
   102  // ```
   103  type TrustAnchor struct {
   104  	pulumi.CustomResourceState
   105  
   106  	// Amazon Resource Name (ARN) of the Trust Anchor
   107  	Arn pulumi.StringOutput `pulumi:"arn"`
   108  	// Whether or not the Trust Anchor should be enabled.
   109  	Enabled pulumi.BoolOutput `pulumi:"enabled"`
   110  	// The name of the Trust Anchor.
   111  	Name pulumi.StringOutput `pulumi:"name"`
   112  	// The source of trust, documented below
   113  	Source TrustAnchorSourceOutput `pulumi:"source"`
   114  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   115  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   116  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   117  	//
   118  	// Deprecated: Please use `tags` instead.
   119  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   120  }
   121  
   122  // NewTrustAnchor registers a new resource with the given unique name, arguments, and options.
   123  func NewTrustAnchor(ctx *pulumi.Context,
   124  	name string, args *TrustAnchorArgs, opts ...pulumi.ResourceOption) (*TrustAnchor, error) {
   125  	if args == nil {
   126  		return nil, errors.New("missing one or more required arguments")
   127  	}
   128  
   129  	if args.Source == nil {
   130  		return nil, errors.New("invalid value for required argument 'Source'")
   131  	}
   132  	opts = internal.PkgResourceDefaultOpts(opts)
   133  	var resource TrustAnchor
   134  	err := ctx.RegisterResource("aws:rolesanywhere/trustAnchor:TrustAnchor", name, args, &resource, opts...)
   135  	if err != nil {
   136  		return nil, err
   137  	}
   138  	return &resource, nil
   139  }
   140  
   141  // GetTrustAnchor gets an existing TrustAnchor resource's state with the given name, ID, and optional
   142  // state properties that are used to uniquely qualify the lookup (nil if not required).
   143  func GetTrustAnchor(ctx *pulumi.Context,
   144  	name string, id pulumi.IDInput, state *TrustAnchorState, opts ...pulumi.ResourceOption) (*TrustAnchor, error) {
   145  	var resource TrustAnchor
   146  	err := ctx.ReadResource("aws:rolesanywhere/trustAnchor:TrustAnchor", name, id, state, &resource, opts...)
   147  	if err != nil {
   148  		return nil, err
   149  	}
   150  	return &resource, nil
   151  }
   152  
   153  // Input properties used for looking up and filtering TrustAnchor resources.
   154  type trustAnchorState struct {
   155  	// Amazon Resource Name (ARN) of the Trust Anchor
   156  	Arn *string `pulumi:"arn"`
   157  	// Whether or not the Trust Anchor should be enabled.
   158  	Enabled *bool `pulumi:"enabled"`
   159  	// The name of the Trust Anchor.
   160  	Name *string `pulumi:"name"`
   161  	// The source of trust, documented below
   162  	Source *TrustAnchorSource `pulumi:"source"`
   163  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   164  	Tags map[string]string `pulumi:"tags"`
   165  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   166  	//
   167  	// Deprecated: Please use `tags` instead.
   168  	TagsAll map[string]string `pulumi:"tagsAll"`
   169  }
   170  
   171  type TrustAnchorState struct {
   172  	// Amazon Resource Name (ARN) of the Trust Anchor
   173  	Arn pulumi.StringPtrInput
   174  	// Whether or not the Trust Anchor should be enabled.
   175  	Enabled pulumi.BoolPtrInput
   176  	// The name of the Trust Anchor.
   177  	Name pulumi.StringPtrInput
   178  	// The source of trust, documented below
   179  	Source TrustAnchorSourcePtrInput
   180  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   181  	Tags pulumi.StringMapInput
   182  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   183  	//
   184  	// Deprecated: Please use `tags` instead.
   185  	TagsAll pulumi.StringMapInput
   186  }
   187  
   188  func (TrustAnchorState) ElementType() reflect.Type {
   189  	return reflect.TypeOf((*trustAnchorState)(nil)).Elem()
   190  }
   191  
   192  type trustAnchorArgs struct {
   193  	// Whether or not the Trust Anchor should be enabled.
   194  	Enabled *bool `pulumi:"enabled"`
   195  	// The name of the Trust Anchor.
   196  	Name *string `pulumi:"name"`
   197  	// The source of trust, documented below
   198  	Source TrustAnchorSource `pulumi:"source"`
   199  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   200  	Tags map[string]string `pulumi:"tags"`
   201  }
   202  
   203  // The set of arguments for constructing a TrustAnchor resource.
   204  type TrustAnchorArgs struct {
   205  	// Whether or not the Trust Anchor should be enabled.
   206  	Enabled pulumi.BoolPtrInput
   207  	// The name of the Trust Anchor.
   208  	Name pulumi.StringPtrInput
   209  	// The source of trust, documented below
   210  	Source TrustAnchorSourceInput
   211  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   212  	Tags pulumi.StringMapInput
   213  }
   214  
   215  func (TrustAnchorArgs) ElementType() reflect.Type {
   216  	return reflect.TypeOf((*trustAnchorArgs)(nil)).Elem()
   217  }
   218  
   219  type TrustAnchorInput interface {
   220  	pulumi.Input
   221  
   222  	ToTrustAnchorOutput() TrustAnchorOutput
   223  	ToTrustAnchorOutputWithContext(ctx context.Context) TrustAnchorOutput
   224  }
   225  
   226  func (*TrustAnchor) ElementType() reflect.Type {
   227  	return reflect.TypeOf((**TrustAnchor)(nil)).Elem()
   228  }
   229  
   230  func (i *TrustAnchor) ToTrustAnchorOutput() TrustAnchorOutput {
   231  	return i.ToTrustAnchorOutputWithContext(context.Background())
   232  }
   233  
   234  func (i *TrustAnchor) ToTrustAnchorOutputWithContext(ctx context.Context) TrustAnchorOutput {
   235  	return pulumi.ToOutputWithContext(ctx, i).(TrustAnchorOutput)
   236  }
   237  
   238  // TrustAnchorArrayInput is an input type that accepts TrustAnchorArray and TrustAnchorArrayOutput values.
   239  // You can construct a concrete instance of `TrustAnchorArrayInput` via:
   240  //
   241  //	TrustAnchorArray{ TrustAnchorArgs{...} }
   242  type TrustAnchorArrayInput interface {
   243  	pulumi.Input
   244  
   245  	ToTrustAnchorArrayOutput() TrustAnchorArrayOutput
   246  	ToTrustAnchorArrayOutputWithContext(context.Context) TrustAnchorArrayOutput
   247  }
   248  
   249  type TrustAnchorArray []TrustAnchorInput
   250  
   251  func (TrustAnchorArray) ElementType() reflect.Type {
   252  	return reflect.TypeOf((*[]*TrustAnchor)(nil)).Elem()
   253  }
   254  
   255  func (i TrustAnchorArray) ToTrustAnchorArrayOutput() TrustAnchorArrayOutput {
   256  	return i.ToTrustAnchorArrayOutputWithContext(context.Background())
   257  }
   258  
   259  func (i TrustAnchorArray) ToTrustAnchorArrayOutputWithContext(ctx context.Context) TrustAnchorArrayOutput {
   260  	return pulumi.ToOutputWithContext(ctx, i).(TrustAnchorArrayOutput)
   261  }
   262  
   263  // TrustAnchorMapInput is an input type that accepts TrustAnchorMap and TrustAnchorMapOutput values.
   264  // You can construct a concrete instance of `TrustAnchorMapInput` via:
   265  //
   266  //	TrustAnchorMap{ "key": TrustAnchorArgs{...} }
   267  type TrustAnchorMapInput interface {
   268  	pulumi.Input
   269  
   270  	ToTrustAnchorMapOutput() TrustAnchorMapOutput
   271  	ToTrustAnchorMapOutputWithContext(context.Context) TrustAnchorMapOutput
   272  }
   273  
   274  type TrustAnchorMap map[string]TrustAnchorInput
   275  
   276  func (TrustAnchorMap) ElementType() reflect.Type {
   277  	return reflect.TypeOf((*map[string]*TrustAnchor)(nil)).Elem()
   278  }
   279  
   280  func (i TrustAnchorMap) ToTrustAnchorMapOutput() TrustAnchorMapOutput {
   281  	return i.ToTrustAnchorMapOutputWithContext(context.Background())
   282  }
   283  
   284  func (i TrustAnchorMap) ToTrustAnchorMapOutputWithContext(ctx context.Context) TrustAnchorMapOutput {
   285  	return pulumi.ToOutputWithContext(ctx, i).(TrustAnchorMapOutput)
   286  }
   287  
   288  type TrustAnchorOutput struct{ *pulumi.OutputState }
   289  
   290  func (TrustAnchorOutput) ElementType() reflect.Type {
   291  	return reflect.TypeOf((**TrustAnchor)(nil)).Elem()
   292  }
   293  
   294  func (o TrustAnchorOutput) ToTrustAnchorOutput() TrustAnchorOutput {
   295  	return o
   296  }
   297  
   298  func (o TrustAnchorOutput) ToTrustAnchorOutputWithContext(ctx context.Context) TrustAnchorOutput {
   299  	return o
   300  }
   301  
   302  // Amazon Resource Name (ARN) of the Trust Anchor
   303  func (o TrustAnchorOutput) Arn() pulumi.StringOutput {
   304  	return o.ApplyT(func(v *TrustAnchor) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   305  }
   306  
   307  // Whether or not the Trust Anchor should be enabled.
   308  func (o TrustAnchorOutput) Enabled() pulumi.BoolOutput {
   309  	return o.ApplyT(func(v *TrustAnchor) pulumi.BoolOutput { return v.Enabled }).(pulumi.BoolOutput)
   310  }
   311  
   312  // The name of the Trust Anchor.
   313  func (o TrustAnchorOutput) Name() pulumi.StringOutput {
   314  	return o.ApplyT(func(v *TrustAnchor) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   315  }
   316  
   317  // The source of trust, documented below
   318  func (o TrustAnchorOutput) Source() TrustAnchorSourceOutput {
   319  	return o.ApplyT(func(v *TrustAnchor) TrustAnchorSourceOutput { return v.Source }).(TrustAnchorSourceOutput)
   320  }
   321  
   322  // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   323  func (o TrustAnchorOutput) Tags() pulumi.StringMapOutput {
   324  	return o.ApplyT(func(v *TrustAnchor) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   325  }
   326  
   327  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   328  //
   329  // Deprecated: Please use `tags` instead.
   330  func (o TrustAnchorOutput) TagsAll() pulumi.StringMapOutput {
   331  	return o.ApplyT(func(v *TrustAnchor) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   332  }
   333  
   334  type TrustAnchorArrayOutput struct{ *pulumi.OutputState }
   335  
   336  func (TrustAnchorArrayOutput) ElementType() reflect.Type {
   337  	return reflect.TypeOf((*[]*TrustAnchor)(nil)).Elem()
   338  }
   339  
   340  func (o TrustAnchorArrayOutput) ToTrustAnchorArrayOutput() TrustAnchorArrayOutput {
   341  	return o
   342  }
   343  
   344  func (o TrustAnchorArrayOutput) ToTrustAnchorArrayOutputWithContext(ctx context.Context) TrustAnchorArrayOutput {
   345  	return o
   346  }
   347  
   348  func (o TrustAnchorArrayOutput) Index(i pulumi.IntInput) TrustAnchorOutput {
   349  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *TrustAnchor {
   350  		return vs[0].([]*TrustAnchor)[vs[1].(int)]
   351  	}).(TrustAnchorOutput)
   352  }
   353  
   354  type TrustAnchorMapOutput struct{ *pulumi.OutputState }
   355  
   356  func (TrustAnchorMapOutput) ElementType() reflect.Type {
   357  	return reflect.TypeOf((*map[string]*TrustAnchor)(nil)).Elem()
   358  }
   359  
   360  func (o TrustAnchorMapOutput) ToTrustAnchorMapOutput() TrustAnchorMapOutput {
   361  	return o
   362  }
   363  
   364  func (o TrustAnchorMapOutput) ToTrustAnchorMapOutputWithContext(ctx context.Context) TrustAnchorMapOutput {
   365  	return o
   366  }
   367  
   368  func (o TrustAnchorMapOutput) MapIndex(k pulumi.StringInput) TrustAnchorOutput {
   369  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *TrustAnchor {
   370  		return vs[0].(map[string]*TrustAnchor)[vs[1].(string)]
   371  	}).(TrustAnchorOutput)
   372  }
   373  
   374  func init() {
   375  	pulumi.RegisterInputType(reflect.TypeOf((*TrustAnchorInput)(nil)).Elem(), &TrustAnchor{})
   376  	pulumi.RegisterInputType(reflect.TypeOf((*TrustAnchorArrayInput)(nil)).Elem(), TrustAnchorArray{})
   377  	pulumi.RegisterInputType(reflect.TypeOf((*TrustAnchorMapInput)(nil)).Elem(), TrustAnchorMap{})
   378  	pulumi.RegisterOutputType(TrustAnchorOutput{})
   379  	pulumi.RegisterOutputType(TrustAnchorArrayOutput{})
   380  	pulumi.RegisterOutputType(TrustAnchorMapOutput{})
   381  }