github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ecs/cluster.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 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 // Provides an ECS cluster. 15 // 16 // ## Example Usage 17 // 18 // <!--Start PulumiCodeChooser --> 19 // ```go 20 // package main 21 // 22 // import ( 23 // 24 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ecs" 25 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 26 // 27 // ) 28 // 29 // func main() { 30 // pulumi.Run(func(ctx *pulumi.Context) error { 31 // _, err := ecs.NewCluster(ctx, "foo", &ecs.ClusterArgs{ 32 // Name: pulumi.String("white-hart"), 33 // Settings: ecs.ClusterSettingArray{ 34 // &ecs.ClusterSettingArgs{ 35 // Name: pulumi.String("containerInsights"), 36 // Value: pulumi.String("enabled"), 37 // }, 38 // }, 39 // }) 40 // if err != nil { 41 // return err 42 // } 43 // return nil 44 // }) 45 // } 46 // 47 // ``` 48 // <!--End PulumiCodeChooser --> 49 // 50 // ### Example with Log Configuration 51 // 52 // <!--Start PulumiCodeChooser --> 53 // ```go 54 // package main 55 // 56 // import ( 57 // 58 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch" 59 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ecs" 60 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kms" 61 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 62 // 63 // ) 64 // 65 // func main() { 66 // pulumi.Run(func(ctx *pulumi.Context) error { 67 // example, err := kms.NewKey(ctx, "example", &kms.KeyArgs{ 68 // Description: pulumi.String("example"), 69 // DeletionWindowInDays: pulumi.Int(7), 70 // }) 71 // if err != nil { 72 // return err 73 // } 74 // exampleLogGroup, err := cloudwatch.NewLogGroup(ctx, "example", &cloudwatch.LogGroupArgs{ 75 // Name: pulumi.String("example"), 76 // }) 77 // if err != nil { 78 // return err 79 // } 80 // _, err = ecs.NewCluster(ctx, "test", &ecs.ClusterArgs{ 81 // Name: pulumi.String("example"), 82 // Configuration: &ecs.ClusterConfigurationArgs{ 83 // ExecuteCommandConfiguration: &ecs.ClusterConfigurationExecuteCommandConfigurationArgs{ 84 // KmsKeyId: example.Arn, 85 // Logging: pulumi.String("OVERRIDE"), 86 // LogConfiguration: &ecs.ClusterConfigurationExecuteCommandConfigurationLogConfigurationArgs{ 87 // CloudWatchEncryptionEnabled: pulumi.Bool(true), 88 // CloudWatchLogGroupName: exampleLogGroup.Name, 89 // }, 90 // }, 91 // }, 92 // }) 93 // if err != nil { 94 // return err 95 // } 96 // return nil 97 // }) 98 // } 99 // 100 // ``` 101 // <!--End PulumiCodeChooser --> 102 // 103 // ## Import 104 // 105 // Using `pulumi import`, import ECS clusters using the `name`. For example: 106 // 107 // ```sh 108 // $ pulumi import aws:ecs/cluster:Cluster stateless stateless-app 109 // ``` 110 type Cluster struct { 111 pulumi.CustomResourceState 112 113 // ARN that identifies the cluster. 114 Arn pulumi.StringOutput `pulumi:"arn"` 115 // The execute command configuration for the cluster. Detailed below. 116 Configuration ClusterConfigurationPtrOutput `pulumi:"configuration"` 117 // Name of the cluster (up to 255 letters, numbers, hyphens, and underscores) 118 Name pulumi.StringOutput `pulumi:"name"` 119 // Configures a default Service Connect namespace. Detailed below. 120 ServiceConnectDefaults ClusterServiceConnectDefaultsPtrOutput `pulumi:"serviceConnectDefaults"` 121 // Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster. Detailed below. 122 Settings ClusterSettingArrayOutput `pulumi:"settings"` 123 // 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. 124 Tags pulumi.StringMapOutput `pulumi:"tags"` 125 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 126 // 127 // Deprecated: Please use `tags` instead. 128 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 129 } 130 131 // NewCluster registers a new resource with the given unique name, arguments, and options. 132 func NewCluster(ctx *pulumi.Context, 133 name string, args *ClusterArgs, opts ...pulumi.ResourceOption) (*Cluster, error) { 134 if args == nil { 135 args = &ClusterArgs{} 136 } 137 138 opts = internal.PkgResourceDefaultOpts(opts) 139 var resource Cluster 140 err := ctx.RegisterResource("aws:ecs/cluster:Cluster", name, args, &resource, opts...) 141 if err != nil { 142 return nil, err 143 } 144 return &resource, nil 145 } 146 147 // GetCluster gets an existing Cluster resource's state with the given name, ID, and optional 148 // state properties that are used to uniquely qualify the lookup (nil if not required). 149 func GetCluster(ctx *pulumi.Context, 150 name string, id pulumi.IDInput, state *ClusterState, opts ...pulumi.ResourceOption) (*Cluster, error) { 151 var resource Cluster 152 err := ctx.ReadResource("aws:ecs/cluster:Cluster", name, id, state, &resource, opts...) 153 if err != nil { 154 return nil, err 155 } 156 return &resource, nil 157 } 158 159 // Input properties used for looking up and filtering Cluster resources. 160 type clusterState struct { 161 // ARN that identifies the cluster. 162 Arn *string `pulumi:"arn"` 163 // The execute command configuration for the cluster. Detailed below. 164 Configuration *ClusterConfiguration `pulumi:"configuration"` 165 // Name of the cluster (up to 255 letters, numbers, hyphens, and underscores) 166 Name *string `pulumi:"name"` 167 // Configures a default Service Connect namespace. Detailed below. 168 ServiceConnectDefaults *ClusterServiceConnectDefaults `pulumi:"serviceConnectDefaults"` 169 // Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster. Detailed below. 170 Settings []ClusterSetting `pulumi:"settings"` 171 // 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. 172 Tags map[string]string `pulumi:"tags"` 173 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 174 // 175 // Deprecated: Please use `tags` instead. 176 TagsAll map[string]string `pulumi:"tagsAll"` 177 } 178 179 type ClusterState struct { 180 // ARN that identifies the cluster. 181 Arn pulumi.StringPtrInput 182 // The execute command configuration for the cluster. Detailed below. 183 Configuration ClusterConfigurationPtrInput 184 // Name of the cluster (up to 255 letters, numbers, hyphens, and underscores) 185 Name pulumi.StringPtrInput 186 // Configures a default Service Connect namespace. Detailed below. 187 ServiceConnectDefaults ClusterServiceConnectDefaultsPtrInput 188 // Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster. Detailed below. 189 Settings ClusterSettingArrayInput 190 // 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. 191 Tags pulumi.StringMapInput 192 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 193 // 194 // Deprecated: Please use `tags` instead. 195 TagsAll pulumi.StringMapInput 196 } 197 198 func (ClusterState) ElementType() reflect.Type { 199 return reflect.TypeOf((*clusterState)(nil)).Elem() 200 } 201 202 type clusterArgs struct { 203 // The execute command configuration for the cluster. Detailed below. 204 Configuration *ClusterConfiguration `pulumi:"configuration"` 205 // Name of the cluster (up to 255 letters, numbers, hyphens, and underscores) 206 Name *string `pulumi:"name"` 207 // Configures a default Service Connect namespace. Detailed below. 208 ServiceConnectDefaults *ClusterServiceConnectDefaults `pulumi:"serviceConnectDefaults"` 209 // Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster. Detailed below. 210 Settings []ClusterSetting `pulumi:"settings"` 211 // 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. 212 Tags map[string]string `pulumi:"tags"` 213 } 214 215 // The set of arguments for constructing a Cluster resource. 216 type ClusterArgs struct { 217 // The execute command configuration for the cluster. Detailed below. 218 Configuration ClusterConfigurationPtrInput 219 // Name of the cluster (up to 255 letters, numbers, hyphens, and underscores) 220 Name pulumi.StringPtrInput 221 // Configures a default Service Connect namespace. Detailed below. 222 ServiceConnectDefaults ClusterServiceConnectDefaultsPtrInput 223 // Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster. Detailed below. 224 Settings ClusterSettingArrayInput 225 // 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. 226 Tags pulumi.StringMapInput 227 } 228 229 func (ClusterArgs) ElementType() reflect.Type { 230 return reflect.TypeOf((*clusterArgs)(nil)).Elem() 231 } 232 233 type ClusterInput interface { 234 pulumi.Input 235 236 ToClusterOutput() ClusterOutput 237 ToClusterOutputWithContext(ctx context.Context) ClusterOutput 238 } 239 240 func (*Cluster) ElementType() reflect.Type { 241 return reflect.TypeOf((**Cluster)(nil)).Elem() 242 } 243 244 func (i *Cluster) ToClusterOutput() ClusterOutput { 245 return i.ToClusterOutputWithContext(context.Background()) 246 } 247 248 func (i *Cluster) ToClusterOutputWithContext(ctx context.Context) ClusterOutput { 249 return pulumi.ToOutputWithContext(ctx, i).(ClusterOutput) 250 } 251 252 // ClusterArrayInput is an input type that accepts ClusterArray and ClusterArrayOutput values. 253 // You can construct a concrete instance of `ClusterArrayInput` via: 254 // 255 // ClusterArray{ ClusterArgs{...} } 256 type ClusterArrayInput interface { 257 pulumi.Input 258 259 ToClusterArrayOutput() ClusterArrayOutput 260 ToClusterArrayOutputWithContext(context.Context) ClusterArrayOutput 261 } 262 263 type ClusterArray []ClusterInput 264 265 func (ClusterArray) ElementType() reflect.Type { 266 return reflect.TypeOf((*[]*Cluster)(nil)).Elem() 267 } 268 269 func (i ClusterArray) ToClusterArrayOutput() ClusterArrayOutput { 270 return i.ToClusterArrayOutputWithContext(context.Background()) 271 } 272 273 func (i ClusterArray) ToClusterArrayOutputWithContext(ctx context.Context) ClusterArrayOutput { 274 return pulumi.ToOutputWithContext(ctx, i).(ClusterArrayOutput) 275 } 276 277 // ClusterMapInput is an input type that accepts ClusterMap and ClusterMapOutput values. 278 // You can construct a concrete instance of `ClusterMapInput` via: 279 // 280 // ClusterMap{ "key": ClusterArgs{...} } 281 type ClusterMapInput interface { 282 pulumi.Input 283 284 ToClusterMapOutput() ClusterMapOutput 285 ToClusterMapOutputWithContext(context.Context) ClusterMapOutput 286 } 287 288 type ClusterMap map[string]ClusterInput 289 290 func (ClusterMap) ElementType() reflect.Type { 291 return reflect.TypeOf((*map[string]*Cluster)(nil)).Elem() 292 } 293 294 func (i ClusterMap) ToClusterMapOutput() ClusterMapOutput { 295 return i.ToClusterMapOutputWithContext(context.Background()) 296 } 297 298 func (i ClusterMap) ToClusterMapOutputWithContext(ctx context.Context) ClusterMapOutput { 299 return pulumi.ToOutputWithContext(ctx, i).(ClusterMapOutput) 300 } 301 302 type ClusterOutput struct{ *pulumi.OutputState } 303 304 func (ClusterOutput) ElementType() reflect.Type { 305 return reflect.TypeOf((**Cluster)(nil)).Elem() 306 } 307 308 func (o ClusterOutput) ToClusterOutput() ClusterOutput { 309 return o 310 } 311 312 func (o ClusterOutput) ToClusterOutputWithContext(ctx context.Context) ClusterOutput { 313 return o 314 } 315 316 // ARN that identifies the cluster. 317 func (o ClusterOutput) Arn() pulumi.StringOutput { 318 return o.ApplyT(func(v *Cluster) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 319 } 320 321 // The execute command configuration for the cluster. Detailed below. 322 func (o ClusterOutput) Configuration() ClusterConfigurationPtrOutput { 323 return o.ApplyT(func(v *Cluster) ClusterConfigurationPtrOutput { return v.Configuration }).(ClusterConfigurationPtrOutput) 324 } 325 326 // Name of the cluster (up to 255 letters, numbers, hyphens, and underscores) 327 func (o ClusterOutput) Name() pulumi.StringOutput { 328 return o.ApplyT(func(v *Cluster) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 329 } 330 331 // Configures a default Service Connect namespace. Detailed below. 332 func (o ClusterOutput) ServiceConnectDefaults() ClusterServiceConnectDefaultsPtrOutput { 333 return o.ApplyT(func(v *Cluster) ClusterServiceConnectDefaultsPtrOutput { return v.ServiceConnectDefaults }).(ClusterServiceConnectDefaultsPtrOutput) 334 } 335 336 // Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster. Detailed below. 337 func (o ClusterOutput) Settings() ClusterSettingArrayOutput { 338 return o.ApplyT(func(v *Cluster) ClusterSettingArrayOutput { return v.Settings }).(ClusterSettingArrayOutput) 339 } 340 341 // 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. 342 func (o ClusterOutput) Tags() pulumi.StringMapOutput { 343 return o.ApplyT(func(v *Cluster) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 344 } 345 346 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 347 // 348 // Deprecated: Please use `tags` instead. 349 func (o ClusterOutput) TagsAll() pulumi.StringMapOutput { 350 return o.ApplyT(func(v *Cluster) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 351 } 352 353 type ClusterArrayOutput struct{ *pulumi.OutputState } 354 355 func (ClusterArrayOutput) ElementType() reflect.Type { 356 return reflect.TypeOf((*[]*Cluster)(nil)).Elem() 357 } 358 359 func (o ClusterArrayOutput) ToClusterArrayOutput() ClusterArrayOutput { 360 return o 361 } 362 363 func (o ClusterArrayOutput) ToClusterArrayOutputWithContext(ctx context.Context) ClusterArrayOutput { 364 return o 365 } 366 367 func (o ClusterArrayOutput) Index(i pulumi.IntInput) ClusterOutput { 368 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Cluster { 369 return vs[0].([]*Cluster)[vs[1].(int)] 370 }).(ClusterOutput) 371 } 372 373 type ClusterMapOutput struct{ *pulumi.OutputState } 374 375 func (ClusterMapOutput) ElementType() reflect.Type { 376 return reflect.TypeOf((*map[string]*Cluster)(nil)).Elem() 377 } 378 379 func (o ClusterMapOutput) ToClusterMapOutput() ClusterMapOutput { 380 return o 381 } 382 383 func (o ClusterMapOutput) ToClusterMapOutputWithContext(ctx context.Context) ClusterMapOutput { 384 return o 385 } 386 387 func (o ClusterMapOutput) MapIndex(k pulumi.StringInput) ClusterOutput { 388 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Cluster { 389 return vs[0].(map[string]*Cluster)[vs[1].(string)] 390 }).(ClusterOutput) 391 } 392 393 func init() { 394 pulumi.RegisterInputType(reflect.TypeOf((*ClusterInput)(nil)).Elem(), &Cluster{}) 395 pulumi.RegisterInputType(reflect.TypeOf((*ClusterArrayInput)(nil)).Elem(), ClusterArray{}) 396 pulumi.RegisterInputType(reflect.TypeOf((*ClusterMapInput)(nil)).Elem(), ClusterMap{}) 397 pulumi.RegisterOutputType(ClusterOutput{}) 398 pulumi.RegisterOutputType(ClusterArrayOutput{}) 399 pulumi.RegisterOutputType(ClusterMapOutput{}) 400 }