github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ecs/capacityProvider.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 ecs 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 ECS cluster capacity provider. More information can be found on the [ECS Developer Guide](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-capacity-providers.html). 16 // 17 // > **NOTE:** Associating an ECS Capacity Provider to an Auto Scaling Group will automatically add the `AmazonECSManaged` tag to the Auto Scaling Group. This tag should be included in the `autoscaling.Group` resource configuration to prevent the provider from removing it in subsequent executions as well as ensuring the `AmazonECSManaged` tag is propagated to all EC2 Instances in the Auto Scaling Group if `minSize` is above 0 on creation. Any EC2 Instances in the Auto Scaling Group without this tag must be manually be updated, otherwise they may cause unexpected scaling behavior and metrics. 18 // 19 // ## Example Usage 20 // 21 // <!--Start PulumiCodeChooser --> 22 // ```go 23 // package main 24 // 25 // import ( 26 // 27 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling" 28 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ecs" 29 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 30 // 31 // ) 32 // 33 // func main() { 34 // pulumi.Run(func(ctx *pulumi.Context) error { 35 // test, err := autoscaling.NewGroup(ctx, "test", &autoscaling.GroupArgs{ 36 // Tags: autoscaling.GroupTagArray{ 37 // &autoscaling.GroupTagArgs{ 38 // Key: pulumi.String("AmazonECSManaged"), 39 // Value: pulumi.String("true"), 40 // PropagateAtLaunch: pulumi.Bool(true), 41 // }, 42 // }, 43 // }) 44 // if err != nil { 45 // return err 46 // } 47 // _, err = ecs.NewCapacityProvider(ctx, "test", &ecs.CapacityProviderArgs{ 48 // Name: pulumi.String("test"), 49 // AutoScalingGroupProvider: &ecs.CapacityProviderAutoScalingGroupProviderArgs{ 50 // AutoScalingGroupArn: test.Arn, 51 // ManagedTerminationProtection: pulumi.String("ENABLED"), 52 // ManagedScaling: &ecs.CapacityProviderAutoScalingGroupProviderManagedScalingArgs{ 53 // MaximumScalingStepSize: pulumi.Int(1000), 54 // MinimumScalingStepSize: pulumi.Int(1), 55 // Status: pulumi.String("ENABLED"), 56 // TargetCapacity: pulumi.Int(10), 57 // }, 58 // }, 59 // }) 60 // if err != nil { 61 // return err 62 // } 63 // return nil 64 // }) 65 // } 66 // 67 // ``` 68 // <!--End PulumiCodeChooser --> 69 // 70 // ## Import 71 // 72 // Using `pulumi import`, import ECS Capacity Providers using the `name`. For example: 73 // 74 // ```sh 75 // $ pulumi import aws:ecs/capacityProvider:CapacityProvider example example 76 // ``` 77 type CapacityProvider struct { 78 pulumi.CustomResourceState 79 80 // ARN that identifies the capacity provider. 81 Arn pulumi.StringOutput `pulumi:"arn"` 82 // Configuration block for the provider for the ECS auto scaling group. Detailed below. 83 AutoScalingGroupProvider CapacityProviderAutoScalingGroupProviderOutput `pulumi:"autoScalingGroupProvider"` 84 // Name of the capacity provider. 85 Name pulumi.StringOutput `pulumi:"name"` 86 // 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. 87 Tags pulumi.StringMapOutput `pulumi:"tags"` 88 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 89 // 90 // Deprecated: Please use `tags` instead. 91 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 92 } 93 94 // NewCapacityProvider registers a new resource with the given unique name, arguments, and options. 95 func NewCapacityProvider(ctx *pulumi.Context, 96 name string, args *CapacityProviderArgs, opts ...pulumi.ResourceOption) (*CapacityProvider, error) { 97 if args == nil { 98 return nil, errors.New("missing one or more required arguments") 99 } 100 101 if args.AutoScalingGroupProvider == nil { 102 return nil, errors.New("invalid value for required argument 'AutoScalingGroupProvider'") 103 } 104 opts = internal.PkgResourceDefaultOpts(opts) 105 var resource CapacityProvider 106 err := ctx.RegisterResource("aws:ecs/capacityProvider:CapacityProvider", name, args, &resource, opts...) 107 if err != nil { 108 return nil, err 109 } 110 return &resource, nil 111 } 112 113 // GetCapacityProvider gets an existing CapacityProvider resource's state with the given name, ID, and optional 114 // state properties that are used to uniquely qualify the lookup (nil if not required). 115 func GetCapacityProvider(ctx *pulumi.Context, 116 name string, id pulumi.IDInput, state *CapacityProviderState, opts ...pulumi.ResourceOption) (*CapacityProvider, error) { 117 var resource CapacityProvider 118 err := ctx.ReadResource("aws:ecs/capacityProvider:CapacityProvider", name, id, state, &resource, opts...) 119 if err != nil { 120 return nil, err 121 } 122 return &resource, nil 123 } 124 125 // Input properties used for looking up and filtering CapacityProvider resources. 126 type capacityProviderState struct { 127 // ARN that identifies the capacity provider. 128 Arn *string `pulumi:"arn"` 129 // Configuration block for the provider for the ECS auto scaling group. Detailed below. 130 AutoScalingGroupProvider *CapacityProviderAutoScalingGroupProvider `pulumi:"autoScalingGroupProvider"` 131 // Name of the capacity provider. 132 Name *string `pulumi:"name"` 133 // 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. 134 Tags map[string]string `pulumi:"tags"` 135 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 136 // 137 // Deprecated: Please use `tags` instead. 138 TagsAll map[string]string `pulumi:"tagsAll"` 139 } 140 141 type CapacityProviderState struct { 142 // ARN that identifies the capacity provider. 143 Arn pulumi.StringPtrInput 144 // Configuration block for the provider for the ECS auto scaling group. Detailed below. 145 AutoScalingGroupProvider CapacityProviderAutoScalingGroupProviderPtrInput 146 // Name of the capacity provider. 147 Name pulumi.StringPtrInput 148 // 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. 149 Tags pulumi.StringMapInput 150 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 151 // 152 // Deprecated: Please use `tags` instead. 153 TagsAll pulumi.StringMapInput 154 } 155 156 func (CapacityProviderState) ElementType() reflect.Type { 157 return reflect.TypeOf((*capacityProviderState)(nil)).Elem() 158 } 159 160 type capacityProviderArgs struct { 161 // Configuration block for the provider for the ECS auto scaling group. Detailed below. 162 AutoScalingGroupProvider CapacityProviderAutoScalingGroupProvider `pulumi:"autoScalingGroupProvider"` 163 // Name of the capacity provider. 164 Name *string `pulumi:"name"` 165 // 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. 166 Tags map[string]string `pulumi:"tags"` 167 } 168 169 // The set of arguments for constructing a CapacityProvider resource. 170 type CapacityProviderArgs struct { 171 // Configuration block for the provider for the ECS auto scaling group. Detailed below. 172 AutoScalingGroupProvider CapacityProviderAutoScalingGroupProviderInput 173 // Name of the capacity provider. 174 Name pulumi.StringPtrInput 175 // 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. 176 Tags pulumi.StringMapInput 177 } 178 179 func (CapacityProviderArgs) ElementType() reflect.Type { 180 return reflect.TypeOf((*capacityProviderArgs)(nil)).Elem() 181 } 182 183 type CapacityProviderInput interface { 184 pulumi.Input 185 186 ToCapacityProviderOutput() CapacityProviderOutput 187 ToCapacityProviderOutputWithContext(ctx context.Context) CapacityProviderOutput 188 } 189 190 func (*CapacityProvider) ElementType() reflect.Type { 191 return reflect.TypeOf((**CapacityProvider)(nil)).Elem() 192 } 193 194 func (i *CapacityProvider) ToCapacityProviderOutput() CapacityProviderOutput { 195 return i.ToCapacityProviderOutputWithContext(context.Background()) 196 } 197 198 func (i *CapacityProvider) ToCapacityProviderOutputWithContext(ctx context.Context) CapacityProviderOutput { 199 return pulumi.ToOutputWithContext(ctx, i).(CapacityProviderOutput) 200 } 201 202 // CapacityProviderArrayInput is an input type that accepts CapacityProviderArray and CapacityProviderArrayOutput values. 203 // You can construct a concrete instance of `CapacityProviderArrayInput` via: 204 // 205 // CapacityProviderArray{ CapacityProviderArgs{...} } 206 type CapacityProviderArrayInput interface { 207 pulumi.Input 208 209 ToCapacityProviderArrayOutput() CapacityProviderArrayOutput 210 ToCapacityProviderArrayOutputWithContext(context.Context) CapacityProviderArrayOutput 211 } 212 213 type CapacityProviderArray []CapacityProviderInput 214 215 func (CapacityProviderArray) ElementType() reflect.Type { 216 return reflect.TypeOf((*[]*CapacityProvider)(nil)).Elem() 217 } 218 219 func (i CapacityProviderArray) ToCapacityProviderArrayOutput() CapacityProviderArrayOutput { 220 return i.ToCapacityProviderArrayOutputWithContext(context.Background()) 221 } 222 223 func (i CapacityProviderArray) ToCapacityProviderArrayOutputWithContext(ctx context.Context) CapacityProviderArrayOutput { 224 return pulumi.ToOutputWithContext(ctx, i).(CapacityProviderArrayOutput) 225 } 226 227 // CapacityProviderMapInput is an input type that accepts CapacityProviderMap and CapacityProviderMapOutput values. 228 // You can construct a concrete instance of `CapacityProviderMapInput` via: 229 // 230 // CapacityProviderMap{ "key": CapacityProviderArgs{...} } 231 type CapacityProviderMapInput interface { 232 pulumi.Input 233 234 ToCapacityProviderMapOutput() CapacityProviderMapOutput 235 ToCapacityProviderMapOutputWithContext(context.Context) CapacityProviderMapOutput 236 } 237 238 type CapacityProviderMap map[string]CapacityProviderInput 239 240 func (CapacityProviderMap) ElementType() reflect.Type { 241 return reflect.TypeOf((*map[string]*CapacityProvider)(nil)).Elem() 242 } 243 244 func (i CapacityProviderMap) ToCapacityProviderMapOutput() CapacityProviderMapOutput { 245 return i.ToCapacityProviderMapOutputWithContext(context.Background()) 246 } 247 248 func (i CapacityProviderMap) ToCapacityProviderMapOutputWithContext(ctx context.Context) CapacityProviderMapOutput { 249 return pulumi.ToOutputWithContext(ctx, i).(CapacityProviderMapOutput) 250 } 251 252 type CapacityProviderOutput struct{ *pulumi.OutputState } 253 254 func (CapacityProviderOutput) ElementType() reflect.Type { 255 return reflect.TypeOf((**CapacityProvider)(nil)).Elem() 256 } 257 258 func (o CapacityProviderOutput) ToCapacityProviderOutput() CapacityProviderOutput { 259 return o 260 } 261 262 func (o CapacityProviderOutput) ToCapacityProviderOutputWithContext(ctx context.Context) CapacityProviderOutput { 263 return o 264 } 265 266 // ARN that identifies the capacity provider. 267 func (o CapacityProviderOutput) Arn() pulumi.StringOutput { 268 return o.ApplyT(func(v *CapacityProvider) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 269 } 270 271 // Configuration block for the provider for the ECS auto scaling group. Detailed below. 272 func (o CapacityProviderOutput) AutoScalingGroupProvider() CapacityProviderAutoScalingGroupProviderOutput { 273 return o.ApplyT(func(v *CapacityProvider) CapacityProviderAutoScalingGroupProviderOutput { 274 return v.AutoScalingGroupProvider 275 }).(CapacityProviderAutoScalingGroupProviderOutput) 276 } 277 278 // Name of the capacity provider. 279 func (o CapacityProviderOutput) Name() pulumi.StringOutput { 280 return o.ApplyT(func(v *CapacityProvider) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 281 } 282 283 // 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. 284 func (o CapacityProviderOutput) Tags() pulumi.StringMapOutput { 285 return o.ApplyT(func(v *CapacityProvider) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 286 } 287 288 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 289 // 290 // Deprecated: Please use `tags` instead. 291 func (o CapacityProviderOutput) TagsAll() pulumi.StringMapOutput { 292 return o.ApplyT(func(v *CapacityProvider) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 293 } 294 295 type CapacityProviderArrayOutput struct{ *pulumi.OutputState } 296 297 func (CapacityProviderArrayOutput) ElementType() reflect.Type { 298 return reflect.TypeOf((*[]*CapacityProvider)(nil)).Elem() 299 } 300 301 func (o CapacityProviderArrayOutput) ToCapacityProviderArrayOutput() CapacityProviderArrayOutput { 302 return o 303 } 304 305 func (o CapacityProviderArrayOutput) ToCapacityProviderArrayOutputWithContext(ctx context.Context) CapacityProviderArrayOutput { 306 return o 307 } 308 309 func (o CapacityProviderArrayOutput) Index(i pulumi.IntInput) CapacityProviderOutput { 310 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *CapacityProvider { 311 return vs[0].([]*CapacityProvider)[vs[1].(int)] 312 }).(CapacityProviderOutput) 313 } 314 315 type CapacityProviderMapOutput struct{ *pulumi.OutputState } 316 317 func (CapacityProviderMapOutput) ElementType() reflect.Type { 318 return reflect.TypeOf((*map[string]*CapacityProvider)(nil)).Elem() 319 } 320 321 func (o CapacityProviderMapOutput) ToCapacityProviderMapOutput() CapacityProviderMapOutput { 322 return o 323 } 324 325 func (o CapacityProviderMapOutput) ToCapacityProviderMapOutputWithContext(ctx context.Context) CapacityProviderMapOutput { 326 return o 327 } 328 329 func (o CapacityProviderMapOutput) MapIndex(k pulumi.StringInput) CapacityProviderOutput { 330 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *CapacityProvider { 331 return vs[0].(map[string]*CapacityProvider)[vs[1].(string)] 332 }).(CapacityProviderOutput) 333 } 334 335 func init() { 336 pulumi.RegisterInputType(reflect.TypeOf((*CapacityProviderInput)(nil)).Elem(), &CapacityProvider{}) 337 pulumi.RegisterInputType(reflect.TypeOf((*CapacityProviderArrayInput)(nil)).Elem(), CapacityProviderArray{}) 338 pulumi.RegisterInputType(reflect.TypeOf((*CapacityProviderMapInput)(nil)).Elem(), CapacityProviderMap{}) 339 pulumi.RegisterOutputType(CapacityProviderOutput{}) 340 pulumi.RegisterOutputType(CapacityProviderArrayOutput{}) 341 pulumi.RegisterOutputType(CapacityProviderMapOutput{}) 342 }