github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/iam/role.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 iam 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 // Provides an IAM role. 16 // 17 // > **NOTE:** If policies are attached to the role via the `iam.PolicyAttachment` resource and you are modifying the role `name` or `path`, the `forceDetachPolicies` argument must be set to `true` and applied before attempting the operation otherwise you will encounter a `DeleteConflict` error. The `iam.RolePolicyAttachment` resource (recommended) does not have this requirement. 18 // 19 // > **NOTE:** If you use this resource's `managedPolicyArns` argument or `inlinePolicy` configuration blocks, this resource will take over exclusive management of the role's respective policy types (e.g., both policy types if both arguments are used). These arguments are incompatible with other ways of managing a role's policies, such as `iam.PolicyAttachment`, `iam.RolePolicyAttachment`, and `iam.RolePolicy`. If you attempt to manage a role's policies by multiple means, you will get resource cycling and/or errors. 20 // 21 // > **NOTE:** We suggest using explicit JSON encoding or `aws.iam.getPolicyDocument` when assigning a value to `policy`. They seamlessly translate configuration to JSON, enabling you to maintain consistency within your configuration without the need for context switches. Also, you can sidestep potential complications arising from formatting discrepancies, whitespace inconsistencies, and other nuances inherent to JSON. 22 // 23 // ## Example Usage 24 // 25 // ### Basic Example 26 // 27 // <!--Start PulumiCodeChooser --> 28 // ```go 29 // package main 30 // 31 // import ( 32 // 33 // "encoding/json" 34 // 35 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 36 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 37 // 38 // ) 39 // 40 // func main() { 41 // pulumi.Run(func(ctx *pulumi.Context) error { 42 // tmpJSON0, err := json.Marshal(map[string]interface{}{ 43 // "Version": "2012-10-17", 44 // "Statement": []map[string]interface{}{ 45 // map[string]interface{}{ 46 // "Action": "sts:AssumeRole", 47 // "Effect": "Allow", 48 // "Sid": "", 49 // "Principal": map[string]interface{}{ 50 // "Service": "ec2.amazonaws.com", 51 // }, 52 // }, 53 // }, 54 // }) 55 // if err != nil { 56 // return err 57 // } 58 // json0 := string(tmpJSON0) 59 // _, err = iam.NewRole(ctx, "test_role", &iam.RoleArgs{ 60 // Name: pulumi.String("test_role"), 61 // AssumeRolePolicy: pulumi.String(json0), 62 // Tags: pulumi.StringMap{ 63 // "tag-key": pulumi.String("tag-value"), 64 // }, 65 // }) 66 // if err != nil { 67 // return err 68 // } 69 // return nil 70 // }) 71 // } 72 // 73 // ``` 74 // <!--End PulumiCodeChooser --> 75 // 76 // ### Example of Using Data Source for Assume Role Policy 77 // 78 // <!--Start PulumiCodeChooser --> 79 // ```go 80 // package main 81 // 82 // import ( 83 // 84 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 85 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 86 // 87 // ) 88 // 89 // func main() { 90 // pulumi.Run(func(ctx *pulumi.Context) error { 91 // instanceAssumeRolePolicy, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{ 92 // Statements: []iam.GetPolicyDocumentStatement{ 93 // { 94 // Actions: []string{ 95 // "sts:AssumeRole", 96 // }, 97 // Principals: []iam.GetPolicyDocumentStatementPrincipal{ 98 // { 99 // Type: "Service", 100 // Identifiers: []string{ 101 // "ec2.amazonaws.com", 102 // }, 103 // }, 104 // }, 105 // }, 106 // }, 107 // }, nil) 108 // if err != nil { 109 // return err 110 // } 111 // _, err = iam.NewRole(ctx, "instance", &iam.RoleArgs{ 112 // Name: pulumi.String("instance_role"), 113 // Path: pulumi.String("/system/"), 114 // AssumeRolePolicy: pulumi.String(instanceAssumeRolePolicy.Json), 115 // }) 116 // if err != nil { 117 // return err 118 // } 119 // return nil 120 // }) 121 // } 122 // 123 // ``` 124 // <!--End PulumiCodeChooser --> 125 // 126 // ### Example of Exclusive Inline Policies 127 // 128 // This example creates an IAM role with two inline IAM policies. If someone adds another inline policy out-of-band, on the next apply, this provider will remove that policy. If someone deletes these policies out-of-band, this provider will recreate them. 129 // 130 // <!--Start PulumiCodeChooser --> 131 // ```go 132 // package main 133 // 134 // import ( 135 // 136 // "encoding/json" 137 // 138 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 139 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 140 // 141 // ) 142 // 143 // func main() { 144 // pulumi.Run(func(ctx *pulumi.Context) error { 145 // inlinePolicy, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{ 146 // Statements: []iam.GetPolicyDocumentStatement{ 147 // { 148 // Actions: []string{ 149 // "ec2:DescribeAccountAttributes", 150 // }, 151 // Resources: []string{ 152 // "*", 153 // }, 154 // }, 155 // }, 156 // }, nil) 157 // if err != nil { 158 // return err 159 // } 160 // tmpJSON0, err := json.Marshal(map[string]interface{}{ 161 // "Version": "2012-10-17", 162 // "Statement": []map[string]interface{}{ 163 // map[string]interface{}{ 164 // "Action": []string{ 165 // "ec2:Describe*", 166 // }, 167 // "Effect": "Allow", 168 // "Resource": "*", 169 // }, 170 // }, 171 // }) 172 // if err != nil { 173 // return err 174 // } 175 // json0 := string(tmpJSON0) 176 // _, err = iam.NewRole(ctx, "example", &iam.RoleArgs{ 177 // Name: pulumi.String("yak_role"), 178 // AssumeRolePolicy: pulumi.Any(instanceAssumeRolePolicy.Json), 179 // InlinePolicies: iam.RoleInlinePolicyArray{ 180 // &iam.RoleInlinePolicyArgs{ 181 // Name: pulumi.String("my_inline_policy"), 182 // Policy: pulumi.String(json0), 183 // }, 184 // &iam.RoleInlinePolicyArgs{ 185 // Name: pulumi.String("policy-8675309"), 186 // Policy: pulumi.String(inlinePolicy.Json), 187 // }, 188 // }, 189 // }) 190 // if err != nil { 191 // return err 192 // } 193 // return nil 194 // }) 195 // } 196 // 197 // ``` 198 // <!--End PulumiCodeChooser --> 199 // 200 // ### Example of Removing Inline Policies 201 // 202 // This example creates an IAM role with what appears to be empty IAM `inlinePolicy` argument instead of using `inlinePolicy` as a configuration block. The result is that if someone were to add an inline policy out-of-band, on the next apply, this provider will remove that policy. 203 // 204 // <!--Start PulumiCodeChooser --> 205 // ```go 206 // package main 207 // 208 // import ( 209 // 210 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 211 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 212 // 213 // ) 214 // 215 // func main() { 216 // pulumi.Run(func(ctx *pulumi.Context) error { 217 // _, err := iam.NewRole(ctx, "example", &iam.RoleArgs{ 218 // InlinePolicies: iam.RoleInlinePolicyArray{ 219 // nil, 220 // }, 221 // Name: pulumi.String("yak_role"), 222 // AssumeRolePolicy: pulumi.Any(instanceAssumeRolePolicy.Json), 223 // }) 224 // if err != nil { 225 // return err 226 // } 227 // return nil 228 // }) 229 // } 230 // 231 // ``` 232 // <!--End PulumiCodeChooser --> 233 // 234 // ### Example of Exclusive Managed Policies 235 // 236 // This example creates an IAM role and attaches two managed IAM policies. If someone attaches another managed policy out-of-band, on the next apply, this provider will detach that policy. If someone detaches these policies out-of-band, this provider will attach them again. 237 // 238 // <!--Start PulumiCodeChooser --> 239 // ```go 240 // package main 241 // 242 // import ( 243 // 244 // "encoding/json" 245 // 246 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 247 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 248 // 249 // ) 250 // 251 // func main() { 252 // pulumi.Run(func(ctx *pulumi.Context) error { 253 // tmpJSON0, err := json.Marshal(map[string]interface{}{ 254 // "Version": "2012-10-17", 255 // "Statement": []map[string]interface{}{ 256 // map[string]interface{}{ 257 // "Action": []string{ 258 // "ec2:Describe*", 259 // }, 260 // "Effect": "Allow", 261 // "Resource": "*", 262 // }, 263 // }, 264 // }) 265 // if err != nil { 266 // return err 267 // } 268 // json0 := string(tmpJSON0) 269 // policyOne, err := iam.NewPolicy(ctx, "policy_one", &iam.PolicyArgs{ 270 // Name: pulumi.String("policy-618033"), 271 // Policy: pulumi.String(json0), 272 // }) 273 // if err != nil { 274 // return err 275 // } 276 // tmpJSON1, err := json.Marshal(map[string]interface{}{ 277 // "Version": "2012-10-17", 278 // "Statement": []map[string]interface{}{ 279 // map[string]interface{}{ 280 // "Action": []string{ 281 // "s3:ListAllMyBuckets", 282 // "s3:ListBucket", 283 // "s3:HeadBucket", 284 // }, 285 // "Effect": "Allow", 286 // "Resource": "*", 287 // }, 288 // }, 289 // }) 290 // if err != nil { 291 // return err 292 // } 293 // json1 := string(tmpJSON1) 294 // policyTwo, err := iam.NewPolicy(ctx, "policy_two", &iam.PolicyArgs{ 295 // Name: pulumi.String("policy-381966"), 296 // Policy: pulumi.String(json1), 297 // }) 298 // if err != nil { 299 // return err 300 // } 301 // _, err = iam.NewRole(ctx, "example", &iam.RoleArgs{ 302 // Name: pulumi.String("yak_role"), 303 // AssumeRolePolicy: pulumi.Any(instanceAssumeRolePolicy.Json), 304 // ManagedPolicyArns: pulumi.StringArray{ 305 // policyOne.Arn, 306 // policyTwo.Arn, 307 // }, 308 // }) 309 // if err != nil { 310 // return err 311 // } 312 // return nil 313 // }) 314 // } 315 // 316 // ``` 317 // <!--End PulumiCodeChooser --> 318 // 319 // ### Example of Removing Managed Policies 320 // 321 // This example creates an IAM role with an empty `managedPolicyArns` argument. If someone attaches a policy out-of-band, on the next apply, this provider will detach that policy. 322 // 323 // <!--Start PulumiCodeChooser --> 324 // ```go 325 // package main 326 // 327 // import ( 328 // 329 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 330 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 331 // 332 // ) 333 // 334 // func main() { 335 // pulumi.Run(func(ctx *pulumi.Context) error { 336 // _, err := iam.NewRole(ctx, "example", &iam.RoleArgs{ 337 // Name: pulumi.String("yak_role"), 338 // AssumeRolePolicy: pulumi.Any(instanceAssumeRolePolicy.Json), 339 // ManagedPolicyArns: pulumi.StringArray{}, 340 // }) 341 // if err != nil { 342 // return err 343 // } 344 // return nil 345 // }) 346 // } 347 // 348 // ``` 349 // <!--End PulumiCodeChooser --> 350 // 351 // ## Import 352 // 353 // Using `pulumi import`, import IAM Roles using the `name`. For example: 354 // 355 // ```sh 356 // $ pulumi import aws:iam/role:Role developer developer_name 357 // ``` 358 type Role struct { 359 pulumi.CustomResourceState 360 361 // Amazon Resource Name (ARN) specifying the role. 362 Arn pulumi.StringOutput `pulumi:"arn"` 363 // Policy that grants an entity permission to assume the role. 364 // 365 // > **NOTE:** The `assumeRolePolicy` is very similar to but slightly different than a standard IAM policy and cannot use an `iam.Policy` resource. However, it _can_ use an `iam.getPolicyDocument` data source. See the example above of how this works. 366 // 367 // The following arguments are optional: 368 AssumeRolePolicy pulumi.StringOutput `pulumi:"assumeRolePolicy"` 369 // Creation date of the IAM role. 370 CreateDate pulumi.StringOutput `pulumi:"createDate"` 371 // Description of the role. 372 Description pulumi.StringPtrOutput `pulumi:"description"` 373 // Whether to force detaching any policies the role has before destroying it. Defaults to `false`. 374 ForceDetachPolicies pulumi.BoolPtrOutput `pulumi:"forceDetachPolicies"` 375 // Configuration block defining an exclusive set of IAM inline policies associated with the IAM role. See below. If no blocks are configured, the provider will not manage any inline policies in this resource. Configuring one empty block (i.e., `inlinePolicy {}`) will cause the provider to remove _all_ inline policies added out of band on `apply`. 376 InlinePolicies RoleInlinePolicyArrayOutput `pulumi:"inlinePolicies"` 377 ManagedPolicyArns pulumi.StringArrayOutput `pulumi:"managedPolicyArns"` 378 // Maximum session duration (in seconds) that you want to set for the specified role. If you do not specify a value for this setting, the default maximum of one hour is applied. This setting can have a value from 1 hour to 12 hours. 379 MaxSessionDuration pulumi.IntPtrOutput `pulumi:"maxSessionDuration"` 380 // Friendly name of the role. If omitted, the provider will assign a random, unique name. See [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) for more information. 381 Name pulumi.StringOutput `pulumi:"name"` 382 // Creates a unique friendly name beginning with the specified prefix. Conflicts with `name`. 383 NamePrefix pulumi.StringOutput `pulumi:"namePrefix"` 384 // Path to the role. See [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) for more information. 385 Path pulumi.StringPtrOutput `pulumi:"path"` 386 // ARN of the policy that is used to set the permissions boundary for the role. 387 PermissionsBoundary pulumi.StringPtrOutput `pulumi:"permissionsBoundary"` 388 // Key-value mapping of tags for the IAM role. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 389 Tags pulumi.StringMapOutput `pulumi:"tags"` 390 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 391 // 392 // Deprecated: Please use `tags` instead. 393 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 394 // Stable and unique string identifying the role. 395 UniqueId pulumi.StringOutput `pulumi:"uniqueId"` 396 } 397 398 // NewRole registers a new resource with the given unique name, arguments, and options. 399 func NewRole(ctx *pulumi.Context, 400 name string, args *RoleArgs, opts ...pulumi.ResourceOption) (*Role, error) { 401 if args == nil { 402 return nil, errors.New("missing one or more required arguments") 403 } 404 405 if args.AssumeRolePolicy == nil { 406 return nil, errors.New("invalid value for required argument 'AssumeRolePolicy'") 407 } 408 opts = internal.PkgResourceDefaultOpts(opts) 409 var resource Role 410 err := ctx.RegisterResource("aws:iam/role:Role", name, args, &resource, opts...) 411 if err != nil { 412 return nil, err 413 } 414 return &resource, nil 415 } 416 417 // GetRole gets an existing Role resource's state with the given name, ID, and optional 418 // state properties that are used to uniquely qualify the lookup (nil if not required). 419 func GetRole(ctx *pulumi.Context, 420 name string, id pulumi.IDInput, state *RoleState, opts ...pulumi.ResourceOption) (*Role, error) { 421 var resource Role 422 err := ctx.ReadResource("aws:iam/role:Role", name, id, state, &resource, opts...) 423 if err != nil { 424 return nil, err 425 } 426 return &resource, nil 427 } 428 429 // Input properties used for looking up and filtering Role resources. 430 type roleState struct { 431 // Amazon Resource Name (ARN) specifying the role. 432 Arn *string `pulumi:"arn"` 433 // Policy that grants an entity permission to assume the role. 434 // 435 // > **NOTE:** The `assumeRolePolicy` is very similar to but slightly different than a standard IAM policy and cannot use an `iam.Policy` resource. However, it _can_ use an `iam.getPolicyDocument` data source. See the example above of how this works. 436 // 437 // The following arguments are optional: 438 AssumeRolePolicy interface{} `pulumi:"assumeRolePolicy"` 439 // Creation date of the IAM role. 440 CreateDate *string `pulumi:"createDate"` 441 // Description of the role. 442 Description *string `pulumi:"description"` 443 // Whether to force detaching any policies the role has before destroying it. Defaults to `false`. 444 ForceDetachPolicies *bool `pulumi:"forceDetachPolicies"` 445 // Configuration block defining an exclusive set of IAM inline policies associated with the IAM role. See below. If no blocks are configured, the provider will not manage any inline policies in this resource. Configuring one empty block (i.e., `inlinePolicy {}`) will cause the provider to remove _all_ inline policies added out of band on `apply`. 446 InlinePolicies []RoleInlinePolicy `pulumi:"inlinePolicies"` 447 ManagedPolicyArns []string `pulumi:"managedPolicyArns"` 448 // Maximum session duration (in seconds) that you want to set for the specified role. If you do not specify a value for this setting, the default maximum of one hour is applied. This setting can have a value from 1 hour to 12 hours. 449 MaxSessionDuration *int `pulumi:"maxSessionDuration"` 450 // Friendly name of the role. If omitted, the provider will assign a random, unique name. See [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) for more information. 451 Name *string `pulumi:"name"` 452 // Creates a unique friendly name beginning with the specified prefix. Conflicts with `name`. 453 NamePrefix *string `pulumi:"namePrefix"` 454 // Path to the role. See [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) for more information. 455 Path *string `pulumi:"path"` 456 // ARN of the policy that is used to set the permissions boundary for the role. 457 PermissionsBoundary *string `pulumi:"permissionsBoundary"` 458 // Key-value mapping of tags for the IAM role. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 459 Tags map[string]string `pulumi:"tags"` 460 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 461 // 462 // Deprecated: Please use `tags` instead. 463 TagsAll map[string]string `pulumi:"tagsAll"` 464 // Stable and unique string identifying the role. 465 UniqueId *string `pulumi:"uniqueId"` 466 } 467 468 type RoleState struct { 469 // Amazon Resource Name (ARN) specifying the role. 470 Arn pulumi.StringPtrInput 471 // Policy that grants an entity permission to assume the role. 472 // 473 // > **NOTE:** The `assumeRolePolicy` is very similar to but slightly different than a standard IAM policy and cannot use an `iam.Policy` resource. However, it _can_ use an `iam.getPolicyDocument` data source. See the example above of how this works. 474 // 475 // The following arguments are optional: 476 AssumeRolePolicy pulumi.Input 477 // Creation date of the IAM role. 478 CreateDate pulumi.StringPtrInput 479 // Description of the role. 480 Description pulumi.StringPtrInput 481 // Whether to force detaching any policies the role has before destroying it. Defaults to `false`. 482 ForceDetachPolicies pulumi.BoolPtrInput 483 // Configuration block defining an exclusive set of IAM inline policies associated with the IAM role. See below. If no blocks are configured, the provider will not manage any inline policies in this resource. Configuring one empty block (i.e., `inlinePolicy {}`) will cause the provider to remove _all_ inline policies added out of band on `apply`. 484 InlinePolicies RoleInlinePolicyArrayInput 485 ManagedPolicyArns pulumi.StringArrayInput 486 // Maximum session duration (in seconds) that you want to set for the specified role. If you do not specify a value for this setting, the default maximum of one hour is applied. This setting can have a value from 1 hour to 12 hours. 487 MaxSessionDuration pulumi.IntPtrInput 488 // Friendly name of the role. If omitted, the provider will assign a random, unique name. See [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) for more information. 489 Name pulumi.StringPtrInput 490 // Creates a unique friendly name beginning with the specified prefix. Conflicts with `name`. 491 NamePrefix pulumi.StringPtrInput 492 // Path to the role. See [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) for more information. 493 Path pulumi.StringPtrInput 494 // ARN of the policy that is used to set the permissions boundary for the role. 495 PermissionsBoundary pulumi.StringPtrInput 496 // Key-value mapping of tags for the IAM role. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 497 Tags pulumi.StringMapInput 498 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 499 // 500 // Deprecated: Please use `tags` instead. 501 TagsAll pulumi.StringMapInput 502 // Stable and unique string identifying the role. 503 UniqueId pulumi.StringPtrInput 504 } 505 506 func (RoleState) ElementType() reflect.Type { 507 return reflect.TypeOf((*roleState)(nil)).Elem() 508 } 509 510 type roleArgs struct { 511 // Policy that grants an entity permission to assume the role. 512 // 513 // > **NOTE:** The `assumeRolePolicy` is very similar to but slightly different than a standard IAM policy and cannot use an `iam.Policy` resource. However, it _can_ use an `iam.getPolicyDocument` data source. See the example above of how this works. 514 // 515 // The following arguments are optional: 516 AssumeRolePolicy interface{} `pulumi:"assumeRolePolicy"` 517 // Description of the role. 518 Description *string `pulumi:"description"` 519 // Whether to force detaching any policies the role has before destroying it. Defaults to `false`. 520 ForceDetachPolicies *bool `pulumi:"forceDetachPolicies"` 521 // Configuration block defining an exclusive set of IAM inline policies associated with the IAM role. See below. If no blocks are configured, the provider will not manage any inline policies in this resource. Configuring one empty block (i.e., `inlinePolicy {}`) will cause the provider to remove _all_ inline policies added out of band on `apply`. 522 InlinePolicies []RoleInlinePolicy `pulumi:"inlinePolicies"` 523 ManagedPolicyArns []string `pulumi:"managedPolicyArns"` 524 // Maximum session duration (in seconds) that you want to set for the specified role. If you do not specify a value for this setting, the default maximum of one hour is applied. This setting can have a value from 1 hour to 12 hours. 525 MaxSessionDuration *int `pulumi:"maxSessionDuration"` 526 // Friendly name of the role. If omitted, the provider will assign a random, unique name. See [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) for more information. 527 Name *string `pulumi:"name"` 528 // Creates a unique friendly name beginning with the specified prefix. Conflicts with `name`. 529 NamePrefix *string `pulumi:"namePrefix"` 530 // Path to the role. See [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) for more information. 531 Path *string `pulumi:"path"` 532 // ARN of the policy that is used to set the permissions boundary for the role. 533 PermissionsBoundary *string `pulumi:"permissionsBoundary"` 534 // Key-value mapping of tags for the IAM role. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 535 Tags map[string]string `pulumi:"tags"` 536 } 537 538 // The set of arguments for constructing a Role resource. 539 type RoleArgs struct { 540 // Policy that grants an entity permission to assume the role. 541 // 542 // > **NOTE:** The `assumeRolePolicy` is very similar to but slightly different than a standard IAM policy and cannot use an `iam.Policy` resource. However, it _can_ use an `iam.getPolicyDocument` data source. See the example above of how this works. 543 // 544 // The following arguments are optional: 545 AssumeRolePolicy pulumi.Input 546 // Description of the role. 547 Description pulumi.StringPtrInput 548 // Whether to force detaching any policies the role has before destroying it. Defaults to `false`. 549 ForceDetachPolicies pulumi.BoolPtrInput 550 // Configuration block defining an exclusive set of IAM inline policies associated with the IAM role. See below. If no blocks are configured, the provider will not manage any inline policies in this resource. Configuring one empty block (i.e., `inlinePolicy {}`) will cause the provider to remove _all_ inline policies added out of band on `apply`. 551 InlinePolicies RoleInlinePolicyArrayInput 552 ManagedPolicyArns pulumi.StringArrayInput 553 // Maximum session duration (in seconds) that you want to set for the specified role. If you do not specify a value for this setting, the default maximum of one hour is applied. This setting can have a value from 1 hour to 12 hours. 554 MaxSessionDuration pulumi.IntPtrInput 555 // Friendly name of the role. If omitted, the provider will assign a random, unique name. See [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) for more information. 556 Name pulumi.StringPtrInput 557 // Creates a unique friendly name beginning with the specified prefix. Conflicts with `name`. 558 NamePrefix pulumi.StringPtrInput 559 // Path to the role. See [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) for more information. 560 Path pulumi.StringPtrInput 561 // ARN of the policy that is used to set the permissions boundary for the role. 562 PermissionsBoundary pulumi.StringPtrInput 563 // Key-value mapping of tags for the IAM role. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 564 Tags pulumi.StringMapInput 565 } 566 567 func (RoleArgs) ElementType() reflect.Type { 568 return reflect.TypeOf((*roleArgs)(nil)).Elem() 569 } 570 571 type RoleInput interface { 572 pulumi.Input 573 574 ToRoleOutput() RoleOutput 575 ToRoleOutputWithContext(ctx context.Context) RoleOutput 576 } 577 578 func (*Role) ElementType() reflect.Type { 579 return reflect.TypeOf((**Role)(nil)).Elem() 580 } 581 582 func (i *Role) ToRoleOutput() RoleOutput { 583 return i.ToRoleOutputWithContext(context.Background()) 584 } 585 586 func (i *Role) ToRoleOutputWithContext(ctx context.Context) RoleOutput { 587 return pulumi.ToOutputWithContext(ctx, i).(RoleOutput) 588 } 589 590 // RoleArrayInput is an input type that accepts RoleArray and RoleArrayOutput values. 591 // You can construct a concrete instance of `RoleArrayInput` via: 592 // 593 // RoleArray{ RoleArgs{...} } 594 type RoleArrayInput interface { 595 pulumi.Input 596 597 ToRoleArrayOutput() RoleArrayOutput 598 ToRoleArrayOutputWithContext(context.Context) RoleArrayOutput 599 } 600 601 type RoleArray []RoleInput 602 603 func (RoleArray) ElementType() reflect.Type { 604 return reflect.TypeOf((*[]*Role)(nil)).Elem() 605 } 606 607 func (i RoleArray) ToRoleArrayOutput() RoleArrayOutput { 608 return i.ToRoleArrayOutputWithContext(context.Background()) 609 } 610 611 func (i RoleArray) ToRoleArrayOutputWithContext(ctx context.Context) RoleArrayOutput { 612 return pulumi.ToOutputWithContext(ctx, i).(RoleArrayOutput) 613 } 614 615 // RoleMapInput is an input type that accepts RoleMap and RoleMapOutput values. 616 // You can construct a concrete instance of `RoleMapInput` via: 617 // 618 // RoleMap{ "key": RoleArgs{...} } 619 type RoleMapInput interface { 620 pulumi.Input 621 622 ToRoleMapOutput() RoleMapOutput 623 ToRoleMapOutputWithContext(context.Context) RoleMapOutput 624 } 625 626 type RoleMap map[string]RoleInput 627 628 func (RoleMap) ElementType() reflect.Type { 629 return reflect.TypeOf((*map[string]*Role)(nil)).Elem() 630 } 631 632 func (i RoleMap) ToRoleMapOutput() RoleMapOutput { 633 return i.ToRoleMapOutputWithContext(context.Background()) 634 } 635 636 func (i RoleMap) ToRoleMapOutputWithContext(ctx context.Context) RoleMapOutput { 637 return pulumi.ToOutputWithContext(ctx, i).(RoleMapOutput) 638 } 639 640 type RoleOutput struct{ *pulumi.OutputState } 641 642 func (RoleOutput) ElementType() reflect.Type { 643 return reflect.TypeOf((**Role)(nil)).Elem() 644 } 645 646 func (o RoleOutput) ToRoleOutput() RoleOutput { 647 return o 648 } 649 650 func (o RoleOutput) ToRoleOutputWithContext(ctx context.Context) RoleOutput { 651 return o 652 } 653 654 // Amazon Resource Name (ARN) specifying the role. 655 func (o RoleOutput) Arn() pulumi.StringOutput { 656 return o.ApplyT(func(v *Role) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 657 } 658 659 // Policy that grants an entity permission to assume the role. 660 // 661 // > **NOTE:** The `assumeRolePolicy` is very similar to but slightly different than a standard IAM policy and cannot use an `iam.Policy` resource. However, it _can_ use an `iam.getPolicyDocument` data source. See the example above of how this works. 662 // 663 // The following arguments are optional: 664 func (o RoleOutput) AssumeRolePolicy() pulumi.StringOutput { 665 return o.ApplyT(func(v *Role) pulumi.StringOutput { return v.AssumeRolePolicy }).(pulumi.StringOutput) 666 } 667 668 // Creation date of the IAM role. 669 func (o RoleOutput) CreateDate() pulumi.StringOutput { 670 return o.ApplyT(func(v *Role) pulumi.StringOutput { return v.CreateDate }).(pulumi.StringOutput) 671 } 672 673 // Description of the role. 674 func (o RoleOutput) Description() pulumi.StringPtrOutput { 675 return o.ApplyT(func(v *Role) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput) 676 } 677 678 // Whether to force detaching any policies the role has before destroying it. Defaults to `false`. 679 func (o RoleOutput) ForceDetachPolicies() pulumi.BoolPtrOutput { 680 return o.ApplyT(func(v *Role) pulumi.BoolPtrOutput { return v.ForceDetachPolicies }).(pulumi.BoolPtrOutput) 681 } 682 683 // Configuration block defining an exclusive set of IAM inline policies associated with the IAM role. See below. If no blocks are configured, the provider will not manage any inline policies in this resource. Configuring one empty block (i.e., `inlinePolicy {}`) will cause the provider to remove _all_ inline policies added out of band on `apply`. 684 func (o RoleOutput) InlinePolicies() RoleInlinePolicyArrayOutput { 685 return o.ApplyT(func(v *Role) RoleInlinePolicyArrayOutput { return v.InlinePolicies }).(RoleInlinePolicyArrayOutput) 686 } 687 688 func (o RoleOutput) ManagedPolicyArns() pulumi.StringArrayOutput { 689 return o.ApplyT(func(v *Role) pulumi.StringArrayOutput { return v.ManagedPolicyArns }).(pulumi.StringArrayOutput) 690 } 691 692 // Maximum session duration (in seconds) that you want to set for the specified role. If you do not specify a value for this setting, the default maximum of one hour is applied. This setting can have a value from 1 hour to 12 hours. 693 func (o RoleOutput) MaxSessionDuration() pulumi.IntPtrOutput { 694 return o.ApplyT(func(v *Role) pulumi.IntPtrOutput { return v.MaxSessionDuration }).(pulumi.IntPtrOutput) 695 } 696 697 // Friendly name of the role. If omitted, the provider will assign a random, unique name. See [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) for more information. 698 func (o RoleOutput) Name() pulumi.StringOutput { 699 return o.ApplyT(func(v *Role) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 700 } 701 702 // Creates a unique friendly name beginning with the specified prefix. Conflicts with `name`. 703 func (o RoleOutput) NamePrefix() pulumi.StringOutput { 704 return o.ApplyT(func(v *Role) pulumi.StringOutput { return v.NamePrefix }).(pulumi.StringOutput) 705 } 706 707 // Path to the role. See [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) for more information. 708 func (o RoleOutput) Path() pulumi.StringPtrOutput { 709 return o.ApplyT(func(v *Role) pulumi.StringPtrOutput { return v.Path }).(pulumi.StringPtrOutput) 710 } 711 712 // ARN of the policy that is used to set the permissions boundary for the role. 713 func (o RoleOutput) PermissionsBoundary() pulumi.StringPtrOutput { 714 return o.ApplyT(func(v *Role) pulumi.StringPtrOutput { return v.PermissionsBoundary }).(pulumi.StringPtrOutput) 715 } 716 717 // Key-value mapping of tags for the IAM role. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 718 func (o RoleOutput) Tags() pulumi.StringMapOutput { 719 return o.ApplyT(func(v *Role) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 720 } 721 722 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 723 // 724 // Deprecated: Please use `tags` instead. 725 func (o RoleOutput) TagsAll() pulumi.StringMapOutput { 726 return o.ApplyT(func(v *Role) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 727 } 728 729 // Stable and unique string identifying the role. 730 func (o RoleOutput) UniqueId() pulumi.StringOutput { 731 return o.ApplyT(func(v *Role) pulumi.StringOutput { return v.UniqueId }).(pulumi.StringOutput) 732 } 733 734 type RoleArrayOutput struct{ *pulumi.OutputState } 735 736 func (RoleArrayOutput) ElementType() reflect.Type { 737 return reflect.TypeOf((*[]*Role)(nil)).Elem() 738 } 739 740 func (o RoleArrayOutput) ToRoleArrayOutput() RoleArrayOutput { 741 return o 742 } 743 744 func (o RoleArrayOutput) ToRoleArrayOutputWithContext(ctx context.Context) RoleArrayOutput { 745 return o 746 } 747 748 func (o RoleArrayOutput) Index(i pulumi.IntInput) RoleOutput { 749 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Role { 750 return vs[0].([]*Role)[vs[1].(int)] 751 }).(RoleOutput) 752 } 753 754 type RoleMapOutput struct{ *pulumi.OutputState } 755 756 func (RoleMapOutput) ElementType() reflect.Type { 757 return reflect.TypeOf((*map[string]*Role)(nil)).Elem() 758 } 759 760 func (o RoleMapOutput) ToRoleMapOutput() RoleMapOutput { 761 return o 762 } 763 764 func (o RoleMapOutput) ToRoleMapOutputWithContext(ctx context.Context) RoleMapOutput { 765 return o 766 } 767 768 func (o RoleMapOutput) MapIndex(k pulumi.StringInput) RoleOutput { 769 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Role { 770 return vs[0].(map[string]*Role)[vs[1].(string)] 771 }).(RoleOutput) 772 } 773 774 func init() { 775 pulumi.RegisterInputType(reflect.TypeOf((*RoleInput)(nil)).Elem(), &Role{}) 776 pulumi.RegisterInputType(reflect.TypeOf((*RoleArrayInput)(nil)).Elem(), RoleArray{}) 777 pulumi.RegisterInputType(reflect.TypeOf((*RoleMapInput)(nil)).Elem(), RoleMap{}) 778 pulumi.RegisterOutputType(RoleOutput{}) 779 pulumi.RegisterOutputType(RoleArrayOutput{}) 780 pulumi.RegisterOutputType(RoleMapOutput{}) 781 }