github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/placementGroup.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 ec2 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 EC2 placement group. Read more about placement groups 16 // in [AWS Docs](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html). 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/ec2" 27 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 28 // 29 // ) 30 // 31 // func main() { 32 // pulumi.Run(func(ctx *pulumi.Context) error { 33 // _, err := ec2.NewPlacementGroup(ctx, "web", &ec2.PlacementGroupArgs{ 34 // Name: pulumi.String("hunky-dory-pg"), 35 // Strategy: pulumi.String(ec2.PlacementStrategyCluster), 36 // }) 37 // if err != nil { 38 // return err 39 // } 40 // return nil 41 // }) 42 // } 43 // 44 // ``` 45 // <!--End PulumiCodeChooser --> 46 // 47 // ## Import 48 // 49 // Using `pulumi import`, import placement groups using the `name`. For example: 50 // 51 // ```sh 52 // $ pulumi import aws:ec2/placementGroup:PlacementGroup prod_pg production-placement-group 53 // ``` 54 type PlacementGroup struct { 55 pulumi.CustomResourceState 56 57 // Amazon Resource Name (ARN) of the placement group. 58 Arn pulumi.StringOutput `pulumi:"arn"` 59 // The name of the placement group. 60 Name pulumi.StringOutput `pulumi:"name"` 61 // The number of partitions to create in the 62 // placement group. Can only be specified when the `strategy` is set to 63 // `partition`. Valid values are 1 - 7 (default is `2`). 64 PartitionCount pulumi.IntOutput `pulumi:"partitionCount"` 65 // The ID of the placement group. 66 PlacementGroupId pulumi.StringOutput `pulumi:"placementGroupId"` 67 // Determines how placement groups spread instances. Can only be used 68 // when the `strategy` is set to `spread`. Can be `host` or `rack`. `host` can only be used for Outpost placement groups. Defaults to `rack`. 69 SpreadLevel pulumi.StringOutput `pulumi:"spreadLevel"` 70 // The placement strategy. Can be `cluster`, `partition` or `spread`. 71 Strategy pulumi.StringOutput `pulumi:"strategy"` 72 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 73 Tags pulumi.StringMapOutput `pulumi:"tags"` 74 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 75 // 76 // Deprecated: Please use `tags` instead. 77 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 78 } 79 80 // NewPlacementGroup registers a new resource with the given unique name, arguments, and options. 81 func NewPlacementGroup(ctx *pulumi.Context, 82 name string, args *PlacementGroupArgs, opts ...pulumi.ResourceOption) (*PlacementGroup, error) { 83 if args == nil { 84 return nil, errors.New("missing one or more required arguments") 85 } 86 87 if args.Strategy == nil { 88 return nil, errors.New("invalid value for required argument 'Strategy'") 89 } 90 opts = internal.PkgResourceDefaultOpts(opts) 91 var resource PlacementGroup 92 err := ctx.RegisterResource("aws:ec2/placementGroup:PlacementGroup", name, args, &resource, opts...) 93 if err != nil { 94 return nil, err 95 } 96 return &resource, nil 97 } 98 99 // GetPlacementGroup gets an existing PlacementGroup resource's state with the given name, ID, and optional 100 // state properties that are used to uniquely qualify the lookup (nil if not required). 101 func GetPlacementGroup(ctx *pulumi.Context, 102 name string, id pulumi.IDInput, state *PlacementGroupState, opts ...pulumi.ResourceOption) (*PlacementGroup, error) { 103 var resource PlacementGroup 104 err := ctx.ReadResource("aws:ec2/placementGroup:PlacementGroup", name, id, state, &resource, opts...) 105 if err != nil { 106 return nil, err 107 } 108 return &resource, nil 109 } 110 111 // Input properties used for looking up and filtering PlacementGroup resources. 112 type placementGroupState struct { 113 // Amazon Resource Name (ARN) of the placement group. 114 Arn *string `pulumi:"arn"` 115 // The name of the placement group. 116 Name *string `pulumi:"name"` 117 // The number of partitions to create in the 118 // placement group. Can only be specified when the `strategy` is set to 119 // `partition`. Valid values are 1 - 7 (default is `2`). 120 PartitionCount *int `pulumi:"partitionCount"` 121 // The ID of the placement group. 122 PlacementGroupId *string `pulumi:"placementGroupId"` 123 // Determines how placement groups spread instances. Can only be used 124 // when the `strategy` is set to `spread`. Can be `host` or `rack`. `host` can only be used for Outpost placement groups. Defaults to `rack`. 125 SpreadLevel *string `pulumi:"spreadLevel"` 126 // The placement strategy. Can be `cluster`, `partition` or `spread`. 127 Strategy *string `pulumi:"strategy"` 128 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 129 Tags map[string]string `pulumi:"tags"` 130 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 131 // 132 // Deprecated: Please use `tags` instead. 133 TagsAll map[string]string `pulumi:"tagsAll"` 134 } 135 136 type PlacementGroupState struct { 137 // Amazon Resource Name (ARN) of the placement group. 138 Arn pulumi.StringPtrInput 139 // The name of the placement group. 140 Name pulumi.StringPtrInput 141 // The number of partitions to create in the 142 // placement group. Can only be specified when the `strategy` is set to 143 // `partition`. Valid values are 1 - 7 (default is `2`). 144 PartitionCount pulumi.IntPtrInput 145 // The ID of the placement group. 146 PlacementGroupId pulumi.StringPtrInput 147 // Determines how placement groups spread instances. Can only be used 148 // when the `strategy` is set to `spread`. Can be `host` or `rack`. `host` can only be used for Outpost placement groups. Defaults to `rack`. 149 SpreadLevel pulumi.StringPtrInput 150 // The placement strategy. Can be `cluster`, `partition` or `spread`. 151 Strategy pulumi.StringPtrInput 152 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 153 Tags pulumi.StringMapInput 154 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 155 // 156 // Deprecated: Please use `tags` instead. 157 TagsAll pulumi.StringMapInput 158 } 159 160 func (PlacementGroupState) ElementType() reflect.Type { 161 return reflect.TypeOf((*placementGroupState)(nil)).Elem() 162 } 163 164 type placementGroupArgs struct { 165 // The name of the placement group. 166 Name *string `pulumi:"name"` 167 // The number of partitions to create in the 168 // placement group. Can only be specified when the `strategy` is set to 169 // `partition`. Valid values are 1 - 7 (default is `2`). 170 PartitionCount *int `pulumi:"partitionCount"` 171 // Determines how placement groups spread instances. Can only be used 172 // when the `strategy` is set to `spread`. Can be `host` or `rack`. `host` can only be used for Outpost placement groups. Defaults to `rack`. 173 SpreadLevel *string `pulumi:"spreadLevel"` 174 // The placement strategy. Can be `cluster`, `partition` or `spread`. 175 Strategy string `pulumi:"strategy"` 176 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 177 Tags map[string]string `pulumi:"tags"` 178 } 179 180 // The set of arguments for constructing a PlacementGroup resource. 181 type PlacementGroupArgs struct { 182 // The name of the placement group. 183 Name pulumi.StringPtrInput 184 // The number of partitions to create in the 185 // placement group. Can only be specified when the `strategy` is set to 186 // `partition`. Valid values are 1 - 7 (default is `2`). 187 PartitionCount pulumi.IntPtrInput 188 // Determines how placement groups spread instances. Can only be used 189 // when the `strategy` is set to `spread`. Can be `host` or `rack`. `host` can only be used for Outpost placement groups. Defaults to `rack`. 190 SpreadLevel pulumi.StringPtrInput 191 // The placement strategy. Can be `cluster`, `partition` or `spread`. 192 Strategy pulumi.StringInput 193 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 194 Tags pulumi.StringMapInput 195 } 196 197 func (PlacementGroupArgs) ElementType() reflect.Type { 198 return reflect.TypeOf((*placementGroupArgs)(nil)).Elem() 199 } 200 201 type PlacementGroupInput interface { 202 pulumi.Input 203 204 ToPlacementGroupOutput() PlacementGroupOutput 205 ToPlacementGroupOutputWithContext(ctx context.Context) PlacementGroupOutput 206 } 207 208 func (*PlacementGroup) ElementType() reflect.Type { 209 return reflect.TypeOf((**PlacementGroup)(nil)).Elem() 210 } 211 212 func (i *PlacementGroup) ToPlacementGroupOutput() PlacementGroupOutput { 213 return i.ToPlacementGroupOutputWithContext(context.Background()) 214 } 215 216 func (i *PlacementGroup) ToPlacementGroupOutputWithContext(ctx context.Context) PlacementGroupOutput { 217 return pulumi.ToOutputWithContext(ctx, i).(PlacementGroupOutput) 218 } 219 220 // PlacementGroupArrayInput is an input type that accepts PlacementGroupArray and PlacementGroupArrayOutput values. 221 // You can construct a concrete instance of `PlacementGroupArrayInput` via: 222 // 223 // PlacementGroupArray{ PlacementGroupArgs{...} } 224 type PlacementGroupArrayInput interface { 225 pulumi.Input 226 227 ToPlacementGroupArrayOutput() PlacementGroupArrayOutput 228 ToPlacementGroupArrayOutputWithContext(context.Context) PlacementGroupArrayOutput 229 } 230 231 type PlacementGroupArray []PlacementGroupInput 232 233 func (PlacementGroupArray) ElementType() reflect.Type { 234 return reflect.TypeOf((*[]*PlacementGroup)(nil)).Elem() 235 } 236 237 func (i PlacementGroupArray) ToPlacementGroupArrayOutput() PlacementGroupArrayOutput { 238 return i.ToPlacementGroupArrayOutputWithContext(context.Background()) 239 } 240 241 func (i PlacementGroupArray) ToPlacementGroupArrayOutputWithContext(ctx context.Context) PlacementGroupArrayOutput { 242 return pulumi.ToOutputWithContext(ctx, i).(PlacementGroupArrayOutput) 243 } 244 245 // PlacementGroupMapInput is an input type that accepts PlacementGroupMap and PlacementGroupMapOutput values. 246 // You can construct a concrete instance of `PlacementGroupMapInput` via: 247 // 248 // PlacementGroupMap{ "key": PlacementGroupArgs{...} } 249 type PlacementGroupMapInput interface { 250 pulumi.Input 251 252 ToPlacementGroupMapOutput() PlacementGroupMapOutput 253 ToPlacementGroupMapOutputWithContext(context.Context) PlacementGroupMapOutput 254 } 255 256 type PlacementGroupMap map[string]PlacementGroupInput 257 258 func (PlacementGroupMap) ElementType() reflect.Type { 259 return reflect.TypeOf((*map[string]*PlacementGroup)(nil)).Elem() 260 } 261 262 func (i PlacementGroupMap) ToPlacementGroupMapOutput() PlacementGroupMapOutput { 263 return i.ToPlacementGroupMapOutputWithContext(context.Background()) 264 } 265 266 func (i PlacementGroupMap) ToPlacementGroupMapOutputWithContext(ctx context.Context) PlacementGroupMapOutput { 267 return pulumi.ToOutputWithContext(ctx, i).(PlacementGroupMapOutput) 268 } 269 270 type PlacementGroupOutput struct{ *pulumi.OutputState } 271 272 func (PlacementGroupOutput) ElementType() reflect.Type { 273 return reflect.TypeOf((**PlacementGroup)(nil)).Elem() 274 } 275 276 func (o PlacementGroupOutput) ToPlacementGroupOutput() PlacementGroupOutput { 277 return o 278 } 279 280 func (o PlacementGroupOutput) ToPlacementGroupOutputWithContext(ctx context.Context) PlacementGroupOutput { 281 return o 282 } 283 284 // Amazon Resource Name (ARN) of the placement group. 285 func (o PlacementGroupOutput) Arn() pulumi.StringOutput { 286 return o.ApplyT(func(v *PlacementGroup) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 287 } 288 289 // The name of the placement group. 290 func (o PlacementGroupOutput) Name() pulumi.StringOutput { 291 return o.ApplyT(func(v *PlacementGroup) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 292 } 293 294 // The number of partitions to create in the 295 // placement group. Can only be specified when the `strategy` is set to 296 // `partition`. Valid values are 1 - 7 (default is `2`). 297 func (o PlacementGroupOutput) PartitionCount() pulumi.IntOutput { 298 return o.ApplyT(func(v *PlacementGroup) pulumi.IntOutput { return v.PartitionCount }).(pulumi.IntOutput) 299 } 300 301 // The ID of the placement group. 302 func (o PlacementGroupOutput) PlacementGroupId() pulumi.StringOutput { 303 return o.ApplyT(func(v *PlacementGroup) pulumi.StringOutput { return v.PlacementGroupId }).(pulumi.StringOutput) 304 } 305 306 // Determines how placement groups spread instances. Can only be used 307 // when the `strategy` is set to `spread`. Can be `host` or `rack`. `host` can only be used for Outpost placement groups. Defaults to `rack`. 308 func (o PlacementGroupOutput) SpreadLevel() pulumi.StringOutput { 309 return o.ApplyT(func(v *PlacementGroup) pulumi.StringOutput { return v.SpreadLevel }).(pulumi.StringOutput) 310 } 311 312 // The placement strategy. Can be `cluster`, `partition` or `spread`. 313 func (o PlacementGroupOutput) Strategy() pulumi.StringOutput { 314 return o.ApplyT(func(v *PlacementGroup) pulumi.StringOutput { return v.Strategy }).(pulumi.StringOutput) 315 } 316 317 // Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 318 func (o PlacementGroupOutput) Tags() pulumi.StringMapOutput { 319 return o.ApplyT(func(v *PlacementGroup) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 320 } 321 322 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 323 // 324 // Deprecated: Please use `tags` instead. 325 func (o PlacementGroupOutput) TagsAll() pulumi.StringMapOutput { 326 return o.ApplyT(func(v *PlacementGroup) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 327 } 328 329 type PlacementGroupArrayOutput struct{ *pulumi.OutputState } 330 331 func (PlacementGroupArrayOutput) ElementType() reflect.Type { 332 return reflect.TypeOf((*[]*PlacementGroup)(nil)).Elem() 333 } 334 335 func (o PlacementGroupArrayOutput) ToPlacementGroupArrayOutput() PlacementGroupArrayOutput { 336 return o 337 } 338 339 func (o PlacementGroupArrayOutput) ToPlacementGroupArrayOutputWithContext(ctx context.Context) PlacementGroupArrayOutput { 340 return o 341 } 342 343 func (o PlacementGroupArrayOutput) Index(i pulumi.IntInput) PlacementGroupOutput { 344 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *PlacementGroup { 345 return vs[0].([]*PlacementGroup)[vs[1].(int)] 346 }).(PlacementGroupOutput) 347 } 348 349 type PlacementGroupMapOutput struct{ *pulumi.OutputState } 350 351 func (PlacementGroupMapOutput) ElementType() reflect.Type { 352 return reflect.TypeOf((*map[string]*PlacementGroup)(nil)).Elem() 353 } 354 355 func (o PlacementGroupMapOutput) ToPlacementGroupMapOutput() PlacementGroupMapOutput { 356 return o 357 } 358 359 func (o PlacementGroupMapOutput) ToPlacementGroupMapOutputWithContext(ctx context.Context) PlacementGroupMapOutput { 360 return o 361 } 362 363 func (o PlacementGroupMapOutput) MapIndex(k pulumi.StringInput) PlacementGroupOutput { 364 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *PlacementGroup { 365 return vs[0].(map[string]*PlacementGroup)[vs[1].(string)] 366 }).(PlacementGroupOutput) 367 } 368 369 func init() { 370 pulumi.RegisterInputType(reflect.TypeOf((*PlacementGroupInput)(nil)).Elem(), &PlacementGroup{}) 371 pulumi.RegisterInputType(reflect.TypeOf((*PlacementGroupArrayInput)(nil)).Elem(), PlacementGroupArray{}) 372 pulumi.RegisterInputType(reflect.TypeOf((*PlacementGroupMapInput)(nil)).Elem(), PlacementGroupMap{}) 373 pulumi.RegisterOutputType(PlacementGroupOutput{}) 374 pulumi.RegisterOutputType(PlacementGroupArrayOutput{}) 375 pulumi.RegisterOutputType(PlacementGroupMapOutput{}) 376 }