github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ssm/activation.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 ssm
     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  // Registers an on-premises server or virtual machine with Amazon EC2 so that it can be managed using Run Command.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssm"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
    34  //				Statements: []iam.GetPolicyDocumentStatement{
    35  //					{
    36  //						Effect: pulumi.StringRef("Allow"),
    37  //						Principals: []iam.GetPolicyDocumentStatementPrincipal{
    38  //							{
    39  //								Type: "Service",
    40  //								Identifiers: []string{
    41  //									"ssm.amazonaws.com",
    42  //								},
    43  //							},
    44  //						},
    45  //						Actions: []string{
    46  //							"sts:AssumeRole",
    47  //						},
    48  //					},
    49  //				},
    50  //			}, nil)
    51  //			if err != nil {
    52  //				return err
    53  //			}
    54  //			testRole, err := iam.NewRole(ctx, "test_role", &iam.RoleArgs{
    55  //				Name:             pulumi.String("test_role"),
    56  //				AssumeRolePolicy: pulumi.String(assumeRole.Json),
    57  //			})
    58  //			if err != nil {
    59  //				return err
    60  //			}
    61  //			testAttach, err := iam.NewRolePolicyAttachment(ctx, "test_attach", &iam.RolePolicyAttachmentArgs{
    62  //				Role:      testRole.Name,
    63  //				PolicyArn: pulumi.String("arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"),
    64  //			})
    65  //			if err != nil {
    66  //				return err
    67  //			}
    68  //			_, err = ssm.NewActivation(ctx, "foo", &ssm.ActivationArgs{
    69  //				Name:              pulumi.String("test_ssm_activation"),
    70  //				Description:       pulumi.String("Test"),
    71  //				IamRole:           testRole.ID(),
    72  //				RegistrationLimit: pulumi.Int(5),
    73  //			}, pulumi.DependsOn([]pulumi.Resource{
    74  //				testAttach,
    75  //			}))
    76  //			if err != nil {
    77  //				return err
    78  //			}
    79  //			return nil
    80  //		})
    81  //	}
    82  //
    83  // ```
    84  // <!--End PulumiCodeChooser -->
    85  //
    86  // ## Import
    87  //
    88  // Using `pulumi import`, import AWS SSM Activation using the `id`. For example:
    89  //
    90  // ```sh
    91  // $ pulumi import aws:ssm/activation:Activation example e488f2f6-e686-4afb-8a04-ef6dfEXAMPLE
    92  // ```
    93  // -> __Note:__ The `activation_code` attribute cannot be imported.
    94  type Activation struct {
    95  	pulumi.CustomResourceState
    96  
    97  	// The code the system generates when it processes the activation.
    98  	ActivationCode pulumi.StringOutput `pulumi:"activationCode"`
    99  	// The description of the resource that you want to register.
   100  	Description pulumi.StringPtrOutput `pulumi:"description"`
   101  	// UTC timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
   102  	ExpirationDate pulumi.StringOutput `pulumi:"expirationDate"`
   103  	// If the current activation has expired.
   104  	Expired pulumi.BoolOutput `pulumi:"expired"`
   105  	// The IAM Role to attach to the managed instance.
   106  	IamRole pulumi.StringOutput `pulumi:"iamRole"`
   107  	// The default name of the registered managed instance.
   108  	Name pulumi.StringOutput `pulumi:"name"`
   109  	// The number of managed instances that are currently registered using this activation.
   110  	RegistrationCount pulumi.IntOutput `pulumi:"registrationCount"`
   111  	// The maximum number of managed instances you want to register. The default value is 1 instance.
   112  	RegistrationLimit pulumi.IntPtrOutput `pulumi:"registrationLimit"`
   113  	// A map of tags to assign to the object. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   114  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   115  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   116  	//
   117  	// Deprecated: Please use `tags` instead.
   118  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   119  }
   120  
   121  // NewActivation registers a new resource with the given unique name, arguments, and options.
   122  func NewActivation(ctx *pulumi.Context,
   123  	name string, args *ActivationArgs, opts ...pulumi.ResourceOption) (*Activation, error) {
   124  	if args == nil {
   125  		return nil, errors.New("missing one or more required arguments")
   126  	}
   127  
   128  	if args.IamRole == nil {
   129  		return nil, errors.New("invalid value for required argument 'IamRole'")
   130  	}
   131  	opts = internal.PkgResourceDefaultOpts(opts)
   132  	var resource Activation
   133  	err := ctx.RegisterResource("aws:ssm/activation:Activation", name, args, &resource, opts...)
   134  	if err != nil {
   135  		return nil, err
   136  	}
   137  	return &resource, nil
   138  }
   139  
   140  // GetActivation gets an existing Activation resource's state with the given name, ID, and optional
   141  // state properties that are used to uniquely qualify the lookup (nil if not required).
   142  func GetActivation(ctx *pulumi.Context,
   143  	name string, id pulumi.IDInput, state *ActivationState, opts ...pulumi.ResourceOption) (*Activation, error) {
   144  	var resource Activation
   145  	err := ctx.ReadResource("aws:ssm/activation:Activation", name, id, state, &resource, opts...)
   146  	if err != nil {
   147  		return nil, err
   148  	}
   149  	return &resource, nil
   150  }
   151  
   152  // Input properties used for looking up and filtering Activation resources.
   153  type activationState struct {
   154  	// The code the system generates when it processes the activation.
   155  	ActivationCode *string `pulumi:"activationCode"`
   156  	// The description of the resource that you want to register.
   157  	Description *string `pulumi:"description"`
   158  	// UTC timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
   159  	ExpirationDate *string `pulumi:"expirationDate"`
   160  	// If the current activation has expired.
   161  	Expired *bool `pulumi:"expired"`
   162  	// The IAM Role to attach to the managed instance.
   163  	IamRole *string `pulumi:"iamRole"`
   164  	// The default name of the registered managed instance.
   165  	Name *string `pulumi:"name"`
   166  	// The number of managed instances that are currently registered using this activation.
   167  	RegistrationCount *int `pulumi:"registrationCount"`
   168  	// The maximum number of managed instances you want to register. The default value is 1 instance.
   169  	RegistrationLimit *int `pulumi:"registrationLimit"`
   170  	// A map of tags to assign to the object. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   171  	Tags map[string]string `pulumi:"tags"`
   172  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   173  	//
   174  	// Deprecated: Please use `tags` instead.
   175  	TagsAll map[string]string `pulumi:"tagsAll"`
   176  }
   177  
   178  type ActivationState struct {
   179  	// The code the system generates when it processes the activation.
   180  	ActivationCode pulumi.StringPtrInput
   181  	// The description of the resource that you want to register.
   182  	Description pulumi.StringPtrInput
   183  	// UTC timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
   184  	ExpirationDate pulumi.StringPtrInput
   185  	// If the current activation has expired.
   186  	Expired pulumi.BoolPtrInput
   187  	// The IAM Role to attach to the managed instance.
   188  	IamRole pulumi.StringPtrInput
   189  	// The default name of the registered managed instance.
   190  	Name pulumi.StringPtrInput
   191  	// The number of managed instances that are currently registered using this activation.
   192  	RegistrationCount pulumi.IntPtrInput
   193  	// The maximum number of managed instances you want to register. The default value is 1 instance.
   194  	RegistrationLimit pulumi.IntPtrInput
   195  	// A map of tags to assign to the object. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   196  	Tags pulumi.StringMapInput
   197  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   198  	//
   199  	// Deprecated: Please use `tags` instead.
   200  	TagsAll pulumi.StringMapInput
   201  }
   202  
   203  func (ActivationState) ElementType() reflect.Type {
   204  	return reflect.TypeOf((*activationState)(nil)).Elem()
   205  }
   206  
   207  type activationArgs struct {
   208  	// The description of the resource that you want to register.
   209  	Description *string `pulumi:"description"`
   210  	// UTC timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
   211  	ExpirationDate *string `pulumi:"expirationDate"`
   212  	// The IAM Role to attach to the managed instance.
   213  	IamRole string `pulumi:"iamRole"`
   214  	// The default name of the registered managed instance.
   215  	Name *string `pulumi:"name"`
   216  	// The maximum number of managed instances you want to register. The default value is 1 instance.
   217  	RegistrationLimit *int `pulumi:"registrationLimit"`
   218  	// A map of tags to assign to the object. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   219  	Tags map[string]string `pulumi:"tags"`
   220  }
   221  
   222  // The set of arguments for constructing a Activation resource.
   223  type ActivationArgs struct {
   224  	// The description of the resource that you want to register.
   225  	Description pulumi.StringPtrInput
   226  	// UTC timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
   227  	ExpirationDate pulumi.StringPtrInput
   228  	// The IAM Role to attach to the managed instance.
   229  	IamRole pulumi.StringInput
   230  	// The default name of the registered managed instance.
   231  	Name pulumi.StringPtrInput
   232  	// The maximum number of managed instances you want to register. The default value is 1 instance.
   233  	RegistrationLimit pulumi.IntPtrInput
   234  	// A map of tags to assign to the object. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   235  	Tags pulumi.StringMapInput
   236  }
   237  
   238  func (ActivationArgs) ElementType() reflect.Type {
   239  	return reflect.TypeOf((*activationArgs)(nil)).Elem()
   240  }
   241  
   242  type ActivationInput interface {
   243  	pulumi.Input
   244  
   245  	ToActivationOutput() ActivationOutput
   246  	ToActivationOutputWithContext(ctx context.Context) ActivationOutput
   247  }
   248  
   249  func (*Activation) ElementType() reflect.Type {
   250  	return reflect.TypeOf((**Activation)(nil)).Elem()
   251  }
   252  
   253  func (i *Activation) ToActivationOutput() ActivationOutput {
   254  	return i.ToActivationOutputWithContext(context.Background())
   255  }
   256  
   257  func (i *Activation) ToActivationOutputWithContext(ctx context.Context) ActivationOutput {
   258  	return pulumi.ToOutputWithContext(ctx, i).(ActivationOutput)
   259  }
   260  
   261  // ActivationArrayInput is an input type that accepts ActivationArray and ActivationArrayOutput values.
   262  // You can construct a concrete instance of `ActivationArrayInput` via:
   263  //
   264  //	ActivationArray{ ActivationArgs{...} }
   265  type ActivationArrayInput interface {
   266  	pulumi.Input
   267  
   268  	ToActivationArrayOutput() ActivationArrayOutput
   269  	ToActivationArrayOutputWithContext(context.Context) ActivationArrayOutput
   270  }
   271  
   272  type ActivationArray []ActivationInput
   273  
   274  func (ActivationArray) ElementType() reflect.Type {
   275  	return reflect.TypeOf((*[]*Activation)(nil)).Elem()
   276  }
   277  
   278  func (i ActivationArray) ToActivationArrayOutput() ActivationArrayOutput {
   279  	return i.ToActivationArrayOutputWithContext(context.Background())
   280  }
   281  
   282  func (i ActivationArray) ToActivationArrayOutputWithContext(ctx context.Context) ActivationArrayOutput {
   283  	return pulumi.ToOutputWithContext(ctx, i).(ActivationArrayOutput)
   284  }
   285  
   286  // ActivationMapInput is an input type that accepts ActivationMap and ActivationMapOutput values.
   287  // You can construct a concrete instance of `ActivationMapInput` via:
   288  //
   289  //	ActivationMap{ "key": ActivationArgs{...} }
   290  type ActivationMapInput interface {
   291  	pulumi.Input
   292  
   293  	ToActivationMapOutput() ActivationMapOutput
   294  	ToActivationMapOutputWithContext(context.Context) ActivationMapOutput
   295  }
   296  
   297  type ActivationMap map[string]ActivationInput
   298  
   299  func (ActivationMap) ElementType() reflect.Type {
   300  	return reflect.TypeOf((*map[string]*Activation)(nil)).Elem()
   301  }
   302  
   303  func (i ActivationMap) ToActivationMapOutput() ActivationMapOutput {
   304  	return i.ToActivationMapOutputWithContext(context.Background())
   305  }
   306  
   307  func (i ActivationMap) ToActivationMapOutputWithContext(ctx context.Context) ActivationMapOutput {
   308  	return pulumi.ToOutputWithContext(ctx, i).(ActivationMapOutput)
   309  }
   310  
   311  type ActivationOutput struct{ *pulumi.OutputState }
   312  
   313  func (ActivationOutput) ElementType() reflect.Type {
   314  	return reflect.TypeOf((**Activation)(nil)).Elem()
   315  }
   316  
   317  func (o ActivationOutput) ToActivationOutput() ActivationOutput {
   318  	return o
   319  }
   320  
   321  func (o ActivationOutput) ToActivationOutputWithContext(ctx context.Context) ActivationOutput {
   322  	return o
   323  }
   324  
   325  // The code the system generates when it processes the activation.
   326  func (o ActivationOutput) ActivationCode() pulumi.StringOutput {
   327  	return o.ApplyT(func(v *Activation) pulumi.StringOutput { return v.ActivationCode }).(pulumi.StringOutput)
   328  }
   329  
   330  // The description of the resource that you want to register.
   331  func (o ActivationOutput) Description() pulumi.StringPtrOutput {
   332  	return o.ApplyT(func(v *Activation) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   333  }
   334  
   335  // UTC timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
   336  func (o ActivationOutput) ExpirationDate() pulumi.StringOutput {
   337  	return o.ApplyT(func(v *Activation) pulumi.StringOutput { return v.ExpirationDate }).(pulumi.StringOutput)
   338  }
   339  
   340  // If the current activation has expired.
   341  func (o ActivationOutput) Expired() pulumi.BoolOutput {
   342  	return o.ApplyT(func(v *Activation) pulumi.BoolOutput { return v.Expired }).(pulumi.BoolOutput)
   343  }
   344  
   345  // The IAM Role to attach to the managed instance.
   346  func (o ActivationOutput) IamRole() pulumi.StringOutput {
   347  	return o.ApplyT(func(v *Activation) pulumi.StringOutput { return v.IamRole }).(pulumi.StringOutput)
   348  }
   349  
   350  // The default name of the registered managed instance.
   351  func (o ActivationOutput) Name() pulumi.StringOutput {
   352  	return o.ApplyT(func(v *Activation) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   353  }
   354  
   355  // The number of managed instances that are currently registered using this activation.
   356  func (o ActivationOutput) RegistrationCount() pulumi.IntOutput {
   357  	return o.ApplyT(func(v *Activation) pulumi.IntOutput { return v.RegistrationCount }).(pulumi.IntOutput)
   358  }
   359  
   360  // The maximum number of managed instances you want to register. The default value is 1 instance.
   361  func (o ActivationOutput) RegistrationLimit() pulumi.IntPtrOutput {
   362  	return o.ApplyT(func(v *Activation) pulumi.IntPtrOutput { return v.RegistrationLimit }).(pulumi.IntPtrOutput)
   363  }
   364  
   365  // A map of tags to assign to the object. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   366  func (o ActivationOutput) Tags() pulumi.StringMapOutput {
   367  	return o.ApplyT(func(v *Activation) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   368  }
   369  
   370  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   371  //
   372  // Deprecated: Please use `tags` instead.
   373  func (o ActivationOutput) TagsAll() pulumi.StringMapOutput {
   374  	return o.ApplyT(func(v *Activation) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   375  }
   376  
   377  type ActivationArrayOutput struct{ *pulumi.OutputState }
   378  
   379  func (ActivationArrayOutput) ElementType() reflect.Type {
   380  	return reflect.TypeOf((*[]*Activation)(nil)).Elem()
   381  }
   382  
   383  func (o ActivationArrayOutput) ToActivationArrayOutput() ActivationArrayOutput {
   384  	return o
   385  }
   386  
   387  func (o ActivationArrayOutput) ToActivationArrayOutputWithContext(ctx context.Context) ActivationArrayOutput {
   388  	return o
   389  }
   390  
   391  func (o ActivationArrayOutput) Index(i pulumi.IntInput) ActivationOutput {
   392  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Activation {
   393  		return vs[0].([]*Activation)[vs[1].(int)]
   394  	}).(ActivationOutput)
   395  }
   396  
   397  type ActivationMapOutput struct{ *pulumi.OutputState }
   398  
   399  func (ActivationMapOutput) ElementType() reflect.Type {
   400  	return reflect.TypeOf((*map[string]*Activation)(nil)).Elem()
   401  }
   402  
   403  func (o ActivationMapOutput) ToActivationMapOutput() ActivationMapOutput {
   404  	return o
   405  }
   406  
   407  func (o ActivationMapOutput) ToActivationMapOutputWithContext(ctx context.Context) ActivationMapOutput {
   408  	return o
   409  }
   410  
   411  func (o ActivationMapOutput) MapIndex(k pulumi.StringInput) ActivationOutput {
   412  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Activation {
   413  		return vs[0].(map[string]*Activation)[vs[1].(string)]
   414  	}).(ActivationOutput)
   415  }
   416  
   417  func init() {
   418  	pulumi.RegisterInputType(reflect.TypeOf((*ActivationInput)(nil)).Elem(), &Activation{})
   419  	pulumi.RegisterInputType(reflect.TypeOf((*ActivationArrayInput)(nil)).Elem(), ActivationArray{})
   420  	pulumi.RegisterInputType(reflect.TypeOf((*ActivationMapInput)(nil)).Elem(), ActivationMap{})
   421  	pulumi.RegisterOutputType(ActivationOutput{})
   422  	pulumi.RegisterOutputType(ActivationArrayOutput{})
   423  	pulumi.RegisterOutputType(ActivationMapOutput{})
   424  }