github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/iam/instanceProfile.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 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 // Provides an IAM instance profile. 15 // 16 // > **NOTE:** When managing instance profiles, remember that the `name` attribute must always be unique. This means that even if you have different `role` or `path` values, duplicating an existing instance profile `name` will lead to an `EntityAlreadyExists` error. 17 // 18 // ## Example Usage 19 // 20 // <!--Start PulumiCodeChooser --> 21 // ```go 22 // package main 23 // 24 // import ( 25 // 26 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 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 // "ec2.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 // role, err := iam.NewRole(ctx, "role", &iam.RoleArgs{ 55 // Name: pulumi.String("test_role"), 56 // Path: pulumi.String("/"), 57 // AssumeRolePolicy: pulumi.String(assumeRole.Json), 58 // }) 59 // if err != nil { 60 // return err 61 // } 62 // _, err = iam.NewInstanceProfile(ctx, "test_profile", &iam.InstanceProfileArgs{ 63 // Name: pulumi.String("test_profile"), 64 // Role: role.Name, 65 // }) 66 // if err != nil { 67 // return err 68 // } 69 // return nil 70 // }) 71 // } 72 // 73 // ``` 74 // <!--End PulumiCodeChooser --> 75 // 76 // ## Import 77 // 78 // Using `pulumi import`, import Instance Profiles using the `name`. For example: 79 // 80 // ```sh 81 // $ pulumi import aws:iam/instanceProfile:InstanceProfile test_profile app-instance-profile-1 82 // ``` 83 type InstanceProfile struct { 84 pulumi.CustomResourceState 85 86 // ARN assigned by AWS to the instance profile. 87 Arn pulumi.StringOutput `pulumi:"arn"` 88 // Creation timestamp of the instance profile. 89 CreateDate pulumi.StringOutput `pulumi:"createDate"` 90 // Name of the instance profile. If omitted, this provider will assign a random, unique name. Conflicts with `namePrefix`. Can be a string of characters consisting of upper and lowercase alphanumeric characters and these special characters: `_`, `+`, `=`, `,`, `.`, `@`, `-`. Spaces are not allowed. The `name` must be unique, regardless of the `path` or `role`. In other words, if there are different `role` or `path` values but the same `name` as an existing instance profile, it will still cause an `EntityAlreadyExists` error. 91 Name pulumi.StringOutput `pulumi:"name"` 92 // Creates a unique name beginning with the specified prefix. Conflicts with `name`. 93 NamePrefix pulumi.StringOutput `pulumi:"namePrefix"` 94 // Path to the instance profile. For more information about paths, see [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) in the IAM User Guide. Can be a string of characters consisting of either a forward slash (`/`) by itself or a string that must begin and end with forward slashes. Can include any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercase letters. 95 Path pulumi.StringPtrOutput `pulumi:"path"` 96 // Name of the role to add to the profile. 97 Role pulumi.StringPtrOutput `pulumi:"role"` 98 // Map of resource tags for the IAM Instance Profile. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 99 Tags pulumi.StringMapOutput `pulumi:"tags"` 100 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 101 // 102 // Deprecated: Please use `tags` instead. 103 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 104 // [Unique ID][1] assigned by AWS. 105 UniqueId pulumi.StringOutput `pulumi:"uniqueId"` 106 } 107 108 // NewInstanceProfile registers a new resource with the given unique name, arguments, and options. 109 func NewInstanceProfile(ctx *pulumi.Context, 110 name string, args *InstanceProfileArgs, opts ...pulumi.ResourceOption) (*InstanceProfile, error) { 111 if args == nil { 112 args = &InstanceProfileArgs{} 113 } 114 115 opts = internal.PkgResourceDefaultOpts(opts) 116 var resource InstanceProfile 117 err := ctx.RegisterResource("aws:iam/instanceProfile:InstanceProfile", name, args, &resource, opts...) 118 if err != nil { 119 return nil, err 120 } 121 return &resource, nil 122 } 123 124 // GetInstanceProfile gets an existing InstanceProfile resource's state with the given name, ID, and optional 125 // state properties that are used to uniquely qualify the lookup (nil if not required). 126 func GetInstanceProfile(ctx *pulumi.Context, 127 name string, id pulumi.IDInput, state *InstanceProfileState, opts ...pulumi.ResourceOption) (*InstanceProfile, error) { 128 var resource InstanceProfile 129 err := ctx.ReadResource("aws:iam/instanceProfile:InstanceProfile", name, id, state, &resource, opts...) 130 if err != nil { 131 return nil, err 132 } 133 return &resource, nil 134 } 135 136 // Input properties used for looking up and filtering InstanceProfile resources. 137 type instanceProfileState struct { 138 // ARN assigned by AWS to the instance profile. 139 Arn *string `pulumi:"arn"` 140 // Creation timestamp of the instance profile. 141 CreateDate *string `pulumi:"createDate"` 142 // Name of the instance profile. If omitted, this provider will assign a random, unique name. Conflicts with `namePrefix`. Can be a string of characters consisting of upper and lowercase alphanumeric characters and these special characters: `_`, `+`, `=`, `,`, `.`, `@`, `-`. Spaces are not allowed. The `name` must be unique, regardless of the `path` or `role`. In other words, if there are different `role` or `path` values but the same `name` as an existing instance profile, it will still cause an `EntityAlreadyExists` error. 143 Name *string `pulumi:"name"` 144 // Creates a unique name beginning with the specified prefix. Conflicts with `name`. 145 NamePrefix *string `pulumi:"namePrefix"` 146 // Path to the instance profile. For more information about paths, see [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) in the IAM User Guide. Can be a string of characters consisting of either a forward slash (`/`) by itself or a string that must begin and end with forward slashes. Can include any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercase letters. 147 Path *string `pulumi:"path"` 148 // Name of the role to add to the profile. 149 Role interface{} `pulumi:"role"` 150 // Map of resource tags for the IAM Instance Profile. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 151 Tags map[string]string `pulumi:"tags"` 152 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 153 // 154 // Deprecated: Please use `tags` instead. 155 TagsAll map[string]string `pulumi:"tagsAll"` 156 // [Unique ID][1] assigned by AWS. 157 UniqueId *string `pulumi:"uniqueId"` 158 } 159 160 type InstanceProfileState struct { 161 // ARN assigned by AWS to the instance profile. 162 Arn pulumi.StringPtrInput 163 // Creation timestamp of the instance profile. 164 CreateDate pulumi.StringPtrInput 165 // Name of the instance profile. If omitted, this provider will assign a random, unique name. Conflicts with `namePrefix`. Can be a string of characters consisting of upper and lowercase alphanumeric characters and these special characters: `_`, `+`, `=`, `,`, `.`, `@`, `-`. Spaces are not allowed. The `name` must be unique, regardless of the `path` or `role`. In other words, if there are different `role` or `path` values but the same `name` as an existing instance profile, it will still cause an `EntityAlreadyExists` error. 166 Name pulumi.StringPtrInput 167 // Creates a unique name beginning with the specified prefix. Conflicts with `name`. 168 NamePrefix pulumi.StringPtrInput 169 // Path to the instance profile. For more information about paths, see [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) in the IAM User Guide. Can be a string of characters consisting of either a forward slash (`/`) by itself or a string that must begin and end with forward slashes. Can include any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercase letters. 170 Path pulumi.StringPtrInput 171 // Name of the role to add to the profile. 172 Role pulumi.Input 173 // Map of resource tags for the IAM Instance Profile. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 174 Tags pulumi.StringMapInput 175 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 176 // 177 // Deprecated: Please use `tags` instead. 178 TagsAll pulumi.StringMapInput 179 // [Unique ID][1] assigned by AWS. 180 UniqueId pulumi.StringPtrInput 181 } 182 183 func (InstanceProfileState) ElementType() reflect.Type { 184 return reflect.TypeOf((*instanceProfileState)(nil)).Elem() 185 } 186 187 type instanceProfileArgs struct { 188 // Name of the instance profile. If omitted, this provider will assign a random, unique name. Conflicts with `namePrefix`. Can be a string of characters consisting of upper and lowercase alphanumeric characters and these special characters: `_`, `+`, `=`, `,`, `.`, `@`, `-`. Spaces are not allowed. The `name` must be unique, regardless of the `path` or `role`. In other words, if there are different `role` or `path` values but the same `name` as an existing instance profile, it will still cause an `EntityAlreadyExists` error. 189 Name *string `pulumi:"name"` 190 // Creates a unique name beginning with the specified prefix. Conflicts with `name`. 191 NamePrefix *string `pulumi:"namePrefix"` 192 // Path to the instance profile. For more information about paths, see [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) in the IAM User Guide. Can be a string of characters consisting of either a forward slash (`/`) by itself or a string that must begin and end with forward slashes. Can include any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercase letters. 193 Path *string `pulumi:"path"` 194 // Name of the role to add to the profile. 195 Role interface{} `pulumi:"role"` 196 // Map of resource tags for the IAM Instance Profile. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 197 Tags map[string]string `pulumi:"tags"` 198 } 199 200 // The set of arguments for constructing a InstanceProfile resource. 201 type InstanceProfileArgs struct { 202 // Name of the instance profile. If omitted, this provider will assign a random, unique name. Conflicts with `namePrefix`. Can be a string of characters consisting of upper and lowercase alphanumeric characters and these special characters: `_`, `+`, `=`, `,`, `.`, `@`, `-`. Spaces are not allowed. The `name` must be unique, regardless of the `path` or `role`. In other words, if there are different `role` or `path` values but the same `name` as an existing instance profile, it will still cause an `EntityAlreadyExists` error. 203 Name pulumi.StringPtrInput 204 // Creates a unique name beginning with the specified prefix. Conflicts with `name`. 205 NamePrefix pulumi.StringPtrInput 206 // Path to the instance profile. For more information about paths, see [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) in the IAM User Guide. Can be a string of characters consisting of either a forward slash (`/`) by itself or a string that must begin and end with forward slashes. Can include any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercase letters. 207 Path pulumi.StringPtrInput 208 // Name of the role to add to the profile. 209 Role pulumi.Input 210 // Map of resource tags for the IAM Instance Profile. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 211 Tags pulumi.StringMapInput 212 } 213 214 func (InstanceProfileArgs) ElementType() reflect.Type { 215 return reflect.TypeOf((*instanceProfileArgs)(nil)).Elem() 216 } 217 218 type InstanceProfileInput interface { 219 pulumi.Input 220 221 ToInstanceProfileOutput() InstanceProfileOutput 222 ToInstanceProfileOutputWithContext(ctx context.Context) InstanceProfileOutput 223 } 224 225 func (*InstanceProfile) ElementType() reflect.Type { 226 return reflect.TypeOf((**InstanceProfile)(nil)).Elem() 227 } 228 229 func (i *InstanceProfile) ToInstanceProfileOutput() InstanceProfileOutput { 230 return i.ToInstanceProfileOutputWithContext(context.Background()) 231 } 232 233 func (i *InstanceProfile) ToInstanceProfileOutputWithContext(ctx context.Context) InstanceProfileOutput { 234 return pulumi.ToOutputWithContext(ctx, i).(InstanceProfileOutput) 235 } 236 237 // InstanceProfileArrayInput is an input type that accepts InstanceProfileArray and InstanceProfileArrayOutput values. 238 // You can construct a concrete instance of `InstanceProfileArrayInput` via: 239 // 240 // InstanceProfileArray{ InstanceProfileArgs{...} } 241 type InstanceProfileArrayInput interface { 242 pulumi.Input 243 244 ToInstanceProfileArrayOutput() InstanceProfileArrayOutput 245 ToInstanceProfileArrayOutputWithContext(context.Context) InstanceProfileArrayOutput 246 } 247 248 type InstanceProfileArray []InstanceProfileInput 249 250 func (InstanceProfileArray) ElementType() reflect.Type { 251 return reflect.TypeOf((*[]*InstanceProfile)(nil)).Elem() 252 } 253 254 func (i InstanceProfileArray) ToInstanceProfileArrayOutput() InstanceProfileArrayOutput { 255 return i.ToInstanceProfileArrayOutputWithContext(context.Background()) 256 } 257 258 func (i InstanceProfileArray) ToInstanceProfileArrayOutputWithContext(ctx context.Context) InstanceProfileArrayOutput { 259 return pulumi.ToOutputWithContext(ctx, i).(InstanceProfileArrayOutput) 260 } 261 262 // InstanceProfileMapInput is an input type that accepts InstanceProfileMap and InstanceProfileMapOutput values. 263 // You can construct a concrete instance of `InstanceProfileMapInput` via: 264 // 265 // InstanceProfileMap{ "key": InstanceProfileArgs{...} } 266 type InstanceProfileMapInput interface { 267 pulumi.Input 268 269 ToInstanceProfileMapOutput() InstanceProfileMapOutput 270 ToInstanceProfileMapOutputWithContext(context.Context) InstanceProfileMapOutput 271 } 272 273 type InstanceProfileMap map[string]InstanceProfileInput 274 275 func (InstanceProfileMap) ElementType() reflect.Type { 276 return reflect.TypeOf((*map[string]*InstanceProfile)(nil)).Elem() 277 } 278 279 func (i InstanceProfileMap) ToInstanceProfileMapOutput() InstanceProfileMapOutput { 280 return i.ToInstanceProfileMapOutputWithContext(context.Background()) 281 } 282 283 func (i InstanceProfileMap) ToInstanceProfileMapOutputWithContext(ctx context.Context) InstanceProfileMapOutput { 284 return pulumi.ToOutputWithContext(ctx, i).(InstanceProfileMapOutput) 285 } 286 287 type InstanceProfileOutput struct{ *pulumi.OutputState } 288 289 func (InstanceProfileOutput) ElementType() reflect.Type { 290 return reflect.TypeOf((**InstanceProfile)(nil)).Elem() 291 } 292 293 func (o InstanceProfileOutput) ToInstanceProfileOutput() InstanceProfileOutput { 294 return o 295 } 296 297 func (o InstanceProfileOutput) ToInstanceProfileOutputWithContext(ctx context.Context) InstanceProfileOutput { 298 return o 299 } 300 301 // ARN assigned by AWS to the instance profile. 302 func (o InstanceProfileOutput) Arn() pulumi.StringOutput { 303 return o.ApplyT(func(v *InstanceProfile) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 304 } 305 306 // Creation timestamp of the instance profile. 307 func (o InstanceProfileOutput) CreateDate() pulumi.StringOutput { 308 return o.ApplyT(func(v *InstanceProfile) pulumi.StringOutput { return v.CreateDate }).(pulumi.StringOutput) 309 } 310 311 // Name of the instance profile. If omitted, this provider will assign a random, unique name. Conflicts with `namePrefix`. Can be a string of characters consisting of upper and lowercase alphanumeric characters and these special characters: `_`, `+`, `=`, `,`, `.`, `@`, `-`. Spaces are not allowed. The `name` must be unique, regardless of the `path` or `role`. In other words, if there are different `role` or `path` values but the same `name` as an existing instance profile, it will still cause an `EntityAlreadyExists` error. 312 func (o InstanceProfileOutput) Name() pulumi.StringOutput { 313 return o.ApplyT(func(v *InstanceProfile) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 314 } 315 316 // Creates a unique name beginning with the specified prefix. Conflicts with `name`. 317 func (o InstanceProfileOutput) NamePrefix() pulumi.StringOutput { 318 return o.ApplyT(func(v *InstanceProfile) pulumi.StringOutput { return v.NamePrefix }).(pulumi.StringOutput) 319 } 320 321 // Path to the instance profile. For more information about paths, see [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) in the IAM User Guide. Can be a string of characters consisting of either a forward slash (`/`) by itself or a string that must begin and end with forward slashes. Can include any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercase letters. 322 func (o InstanceProfileOutput) Path() pulumi.StringPtrOutput { 323 return o.ApplyT(func(v *InstanceProfile) pulumi.StringPtrOutput { return v.Path }).(pulumi.StringPtrOutput) 324 } 325 326 // Name of the role to add to the profile. 327 func (o InstanceProfileOutput) Role() pulumi.StringPtrOutput { 328 return o.ApplyT(func(v *InstanceProfile) pulumi.StringPtrOutput { return v.Role }).(pulumi.StringPtrOutput) 329 } 330 331 // Map of resource tags for the IAM Instance Profile. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 332 func (o InstanceProfileOutput) Tags() pulumi.StringMapOutput { 333 return o.ApplyT(func(v *InstanceProfile) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 334 } 335 336 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 337 // 338 // Deprecated: Please use `tags` instead. 339 func (o InstanceProfileOutput) TagsAll() pulumi.StringMapOutput { 340 return o.ApplyT(func(v *InstanceProfile) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 341 } 342 343 // [Unique ID][1] assigned by AWS. 344 func (o InstanceProfileOutput) UniqueId() pulumi.StringOutput { 345 return o.ApplyT(func(v *InstanceProfile) pulumi.StringOutput { return v.UniqueId }).(pulumi.StringOutput) 346 } 347 348 type InstanceProfileArrayOutput struct{ *pulumi.OutputState } 349 350 func (InstanceProfileArrayOutput) ElementType() reflect.Type { 351 return reflect.TypeOf((*[]*InstanceProfile)(nil)).Elem() 352 } 353 354 func (o InstanceProfileArrayOutput) ToInstanceProfileArrayOutput() InstanceProfileArrayOutput { 355 return o 356 } 357 358 func (o InstanceProfileArrayOutput) ToInstanceProfileArrayOutputWithContext(ctx context.Context) InstanceProfileArrayOutput { 359 return o 360 } 361 362 func (o InstanceProfileArrayOutput) Index(i pulumi.IntInput) InstanceProfileOutput { 363 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *InstanceProfile { 364 return vs[0].([]*InstanceProfile)[vs[1].(int)] 365 }).(InstanceProfileOutput) 366 } 367 368 type InstanceProfileMapOutput struct{ *pulumi.OutputState } 369 370 func (InstanceProfileMapOutput) ElementType() reflect.Type { 371 return reflect.TypeOf((*map[string]*InstanceProfile)(nil)).Elem() 372 } 373 374 func (o InstanceProfileMapOutput) ToInstanceProfileMapOutput() InstanceProfileMapOutput { 375 return o 376 } 377 378 func (o InstanceProfileMapOutput) ToInstanceProfileMapOutputWithContext(ctx context.Context) InstanceProfileMapOutput { 379 return o 380 } 381 382 func (o InstanceProfileMapOutput) MapIndex(k pulumi.StringInput) InstanceProfileOutput { 383 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *InstanceProfile { 384 return vs[0].(map[string]*InstanceProfile)[vs[1].(string)] 385 }).(InstanceProfileOutput) 386 } 387 388 func init() { 389 pulumi.RegisterInputType(reflect.TypeOf((*InstanceProfileInput)(nil)).Elem(), &InstanceProfile{}) 390 pulumi.RegisterInputType(reflect.TypeOf((*InstanceProfileArrayInput)(nil)).Elem(), InstanceProfileArray{}) 391 pulumi.RegisterInputType(reflect.TypeOf((*InstanceProfileMapInput)(nil)).Elem(), InstanceProfileMap{}) 392 pulumi.RegisterOutputType(InstanceProfileOutput{}) 393 pulumi.RegisterOutputType(InstanceProfileArrayOutput{}) 394 pulumi.RegisterOutputType(InstanceProfileMapOutput{}) 395 }