github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/codedeploy/deploymentConfig.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 codedeploy 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 a CodeDeploy deployment config for an application 15 // 16 // ## Example Usage 17 // 18 // ### Server Usage 19 // 20 // <!--Start PulumiCodeChooser --> 21 // ```go 22 // package main 23 // 24 // import ( 25 // 26 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/codedeploy" 27 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 28 // 29 // ) 30 // 31 // func main() { 32 // pulumi.Run(func(ctx *pulumi.Context) error { 33 // foo, err := codedeploy.NewDeploymentConfig(ctx, "foo", &codedeploy.DeploymentConfigArgs{ 34 // DeploymentConfigName: pulumi.String("test-deployment-config"), 35 // MinimumHealthyHosts: &codedeploy.DeploymentConfigMinimumHealthyHostsArgs{ 36 // Type: pulumi.String("HOST_COUNT"), 37 // Value: pulumi.Int(2), 38 // }, 39 // }) 40 // if err != nil { 41 // return err 42 // } 43 // _, err = codedeploy.NewDeploymentGroup(ctx, "foo", &codedeploy.DeploymentGroupArgs{ 44 // AppName: pulumi.Any(fooApp.Name), 45 // DeploymentGroupName: pulumi.String("bar"), 46 // ServiceRoleArn: pulumi.Any(fooRole.Arn), 47 // DeploymentConfigName: foo.ID(), 48 // Ec2TagFilters: codedeploy.DeploymentGroupEc2TagFilterArray{ 49 // &codedeploy.DeploymentGroupEc2TagFilterArgs{ 50 // Key: pulumi.String("filterkey"), 51 // Type: pulumi.String("KEY_AND_VALUE"), 52 // Value: pulumi.String("filtervalue"), 53 // }, 54 // }, 55 // TriggerConfigurations: codedeploy.DeploymentGroupTriggerConfigurationArray{ 56 // &codedeploy.DeploymentGroupTriggerConfigurationArgs{ 57 // TriggerEvents: pulumi.StringArray{ 58 // pulumi.String("DeploymentFailure"), 59 // }, 60 // TriggerName: pulumi.String("foo-trigger"), 61 // TriggerTargetArn: pulumi.String("foo-topic-arn"), 62 // }, 63 // }, 64 // AutoRollbackConfiguration: &codedeploy.DeploymentGroupAutoRollbackConfigurationArgs{ 65 // Enabled: pulumi.Bool(true), 66 // Events: pulumi.StringArray{ 67 // pulumi.String("DEPLOYMENT_FAILURE"), 68 // }, 69 // }, 70 // AlarmConfiguration: &codedeploy.DeploymentGroupAlarmConfigurationArgs{ 71 // Alarms: pulumi.StringArray{ 72 // pulumi.String("my-alarm-name"), 73 // }, 74 // Enabled: pulumi.Bool(true), 75 // }, 76 // }) 77 // if err != nil { 78 // return err 79 // } 80 // return nil 81 // }) 82 // } 83 // 84 // ``` 85 // <!--End PulumiCodeChooser --> 86 // 87 // ### Lambda Usage 88 // 89 // <!--Start PulumiCodeChooser --> 90 // ```go 91 // package main 92 // 93 // import ( 94 // 95 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/codedeploy" 96 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 97 // 98 // ) 99 // 100 // func main() { 101 // pulumi.Run(func(ctx *pulumi.Context) error { 102 // foo, err := codedeploy.NewDeploymentConfig(ctx, "foo", &codedeploy.DeploymentConfigArgs{ 103 // DeploymentConfigName: pulumi.String("test-deployment-config"), 104 // ComputePlatform: pulumi.String("Lambda"), 105 // TrafficRoutingConfig: &codedeploy.DeploymentConfigTrafficRoutingConfigArgs{ 106 // Type: pulumi.String("TimeBasedLinear"), 107 // TimeBasedLinear: &codedeploy.DeploymentConfigTrafficRoutingConfigTimeBasedLinearArgs{ 108 // Interval: pulumi.Int(10), 109 // Percentage: pulumi.Int(10), 110 // }, 111 // }, 112 // }) 113 // if err != nil { 114 // return err 115 // } 116 // _, err = codedeploy.NewDeploymentGroup(ctx, "foo", &codedeploy.DeploymentGroupArgs{ 117 // AppName: pulumi.Any(fooApp.Name), 118 // DeploymentGroupName: pulumi.String("bar"), 119 // ServiceRoleArn: pulumi.Any(fooRole.Arn), 120 // DeploymentConfigName: foo.ID(), 121 // AutoRollbackConfiguration: &codedeploy.DeploymentGroupAutoRollbackConfigurationArgs{ 122 // Enabled: pulumi.Bool(true), 123 // Events: pulumi.StringArray{ 124 // pulumi.String("DEPLOYMENT_STOP_ON_ALARM"), 125 // }, 126 // }, 127 // AlarmConfiguration: &codedeploy.DeploymentGroupAlarmConfigurationArgs{ 128 // Alarms: pulumi.StringArray{ 129 // pulumi.String("my-alarm-name"), 130 // }, 131 // Enabled: pulumi.Bool(true), 132 // }, 133 // }) 134 // if err != nil { 135 // return err 136 // } 137 // return nil 138 // }) 139 // } 140 // 141 // ``` 142 // <!--End PulumiCodeChooser --> 143 // 144 // ## Import 145 // 146 // Using `pulumi import`, import CodeDeploy Deployment Configurations using the `deployment_config_name`. For example: 147 // 148 // ```sh 149 // $ pulumi import aws:codedeploy/deploymentConfig:DeploymentConfig example my-deployment-config 150 // ``` 151 type DeploymentConfig struct { 152 pulumi.CustomResourceState 153 154 // The ARN of the deployment config. 155 Arn pulumi.StringOutput `pulumi:"arn"` 156 // The compute platform can be `Server`, `Lambda`, or `ECS`. Default is `Server`. 157 ComputePlatform pulumi.StringPtrOutput `pulumi:"computePlatform"` 158 // The AWS Assigned deployment config id 159 DeploymentConfigId pulumi.StringOutput `pulumi:"deploymentConfigId"` 160 // The name of the deployment config. 161 DeploymentConfigName pulumi.StringOutput `pulumi:"deploymentConfigName"` 162 // A minimumHealthyHosts block. Required for `Server` compute platform. Minimum Healthy Hosts are documented below. 163 MinimumHealthyHosts DeploymentConfigMinimumHealthyHostsPtrOutput `pulumi:"minimumHealthyHosts"` 164 // A trafficRoutingConfig block. Traffic Routing Config is documented below. 165 TrafficRoutingConfig DeploymentConfigTrafficRoutingConfigPtrOutput `pulumi:"trafficRoutingConfig"` 166 } 167 168 // NewDeploymentConfig registers a new resource with the given unique name, arguments, and options. 169 func NewDeploymentConfig(ctx *pulumi.Context, 170 name string, args *DeploymentConfigArgs, opts ...pulumi.ResourceOption) (*DeploymentConfig, error) { 171 if args == nil { 172 args = &DeploymentConfigArgs{} 173 } 174 175 opts = internal.PkgResourceDefaultOpts(opts) 176 var resource DeploymentConfig 177 err := ctx.RegisterResource("aws:codedeploy/deploymentConfig:DeploymentConfig", name, args, &resource, opts...) 178 if err != nil { 179 return nil, err 180 } 181 return &resource, nil 182 } 183 184 // GetDeploymentConfig gets an existing DeploymentConfig resource's state with the given name, ID, and optional 185 // state properties that are used to uniquely qualify the lookup (nil if not required). 186 func GetDeploymentConfig(ctx *pulumi.Context, 187 name string, id pulumi.IDInput, state *DeploymentConfigState, opts ...pulumi.ResourceOption) (*DeploymentConfig, error) { 188 var resource DeploymentConfig 189 err := ctx.ReadResource("aws:codedeploy/deploymentConfig:DeploymentConfig", name, id, state, &resource, opts...) 190 if err != nil { 191 return nil, err 192 } 193 return &resource, nil 194 } 195 196 // Input properties used for looking up and filtering DeploymentConfig resources. 197 type deploymentConfigState struct { 198 // The ARN of the deployment config. 199 Arn *string `pulumi:"arn"` 200 // The compute platform can be `Server`, `Lambda`, or `ECS`. Default is `Server`. 201 ComputePlatform *string `pulumi:"computePlatform"` 202 // The AWS Assigned deployment config id 203 DeploymentConfigId *string `pulumi:"deploymentConfigId"` 204 // The name of the deployment config. 205 DeploymentConfigName *string `pulumi:"deploymentConfigName"` 206 // A minimumHealthyHosts block. Required for `Server` compute platform. Minimum Healthy Hosts are documented below. 207 MinimumHealthyHosts *DeploymentConfigMinimumHealthyHosts `pulumi:"minimumHealthyHosts"` 208 // A trafficRoutingConfig block. Traffic Routing Config is documented below. 209 TrafficRoutingConfig *DeploymentConfigTrafficRoutingConfig `pulumi:"trafficRoutingConfig"` 210 } 211 212 type DeploymentConfigState struct { 213 // The ARN of the deployment config. 214 Arn pulumi.StringPtrInput 215 // The compute platform can be `Server`, `Lambda`, or `ECS`. Default is `Server`. 216 ComputePlatform pulumi.StringPtrInput 217 // The AWS Assigned deployment config id 218 DeploymentConfigId pulumi.StringPtrInput 219 // The name of the deployment config. 220 DeploymentConfigName pulumi.StringPtrInput 221 // A minimumHealthyHosts block. Required for `Server` compute platform. Minimum Healthy Hosts are documented below. 222 MinimumHealthyHosts DeploymentConfigMinimumHealthyHostsPtrInput 223 // A trafficRoutingConfig block. Traffic Routing Config is documented below. 224 TrafficRoutingConfig DeploymentConfigTrafficRoutingConfigPtrInput 225 } 226 227 func (DeploymentConfigState) ElementType() reflect.Type { 228 return reflect.TypeOf((*deploymentConfigState)(nil)).Elem() 229 } 230 231 type deploymentConfigArgs struct { 232 // The compute platform can be `Server`, `Lambda`, or `ECS`. Default is `Server`. 233 ComputePlatform *string `pulumi:"computePlatform"` 234 // The name of the deployment config. 235 DeploymentConfigName *string `pulumi:"deploymentConfigName"` 236 // A minimumHealthyHosts block. Required for `Server` compute platform. Minimum Healthy Hosts are documented below. 237 MinimumHealthyHosts *DeploymentConfigMinimumHealthyHosts `pulumi:"minimumHealthyHosts"` 238 // A trafficRoutingConfig block. Traffic Routing Config is documented below. 239 TrafficRoutingConfig *DeploymentConfigTrafficRoutingConfig `pulumi:"trafficRoutingConfig"` 240 } 241 242 // The set of arguments for constructing a DeploymentConfig resource. 243 type DeploymentConfigArgs struct { 244 // The compute platform can be `Server`, `Lambda`, or `ECS`. Default is `Server`. 245 ComputePlatform pulumi.StringPtrInput 246 // The name of the deployment config. 247 DeploymentConfigName pulumi.StringPtrInput 248 // A minimumHealthyHosts block. Required for `Server` compute platform. Minimum Healthy Hosts are documented below. 249 MinimumHealthyHosts DeploymentConfigMinimumHealthyHostsPtrInput 250 // A trafficRoutingConfig block. Traffic Routing Config is documented below. 251 TrafficRoutingConfig DeploymentConfigTrafficRoutingConfigPtrInput 252 } 253 254 func (DeploymentConfigArgs) ElementType() reflect.Type { 255 return reflect.TypeOf((*deploymentConfigArgs)(nil)).Elem() 256 } 257 258 type DeploymentConfigInput interface { 259 pulumi.Input 260 261 ToDeploymentConfigOutput() DeploymentConfigOutput 262 ToDeploymentConfigOutputWithContext(ctx context.Context) DeploymentConfigOutput 263 } 264 265 func (*DeploymentConfig) ElementType() reflect.Type { 266 return reflect.TypeOf((**DeploymentConfig)(nil)).Elem() 267 } 268 269 func (i *DeploymentConfig) ToDeploymentConfigOutput() DeploymentConfigOutput { 270 return i.ToDeploymentConfigOutputWithContext(context.Background()) 271 } 272 273 func (i *DeploymentConfig) ToDeploymentConfigOutputWithContext(ctx context.Context) DeploymentConfigOutput { 274 return pulumi.ToOutputWithContext(ctx, i).(DeploymentConfigOutput) 275 } 276 277 // DeploymentConfigArrayInput is an input type that accepts DeploymentConfigArray and DeploymentConfigArrayOutput values. 278 // You can construct a concrete instance of `DeploymentConfigArrayInput` via: 279 // 280 // DeploymentConfigArray{ DeploymentConfigArgs{...} } 281 type DeploymentConfigArrayInput interface { 282 pulumi.Input 283 284 ToDeploymentConfigArrayOutput() DeploymentConfigArrayOutput 285 ToDeploymentConfigArrayOutputWithContext(context.Context) DeploymentConfigArrayOutput 286 } 287 288 type DeploymentConfigArray []DeploymentConfigInput 289 290 func (DeploymentConfigArray) ElementType() reflect.Type { 291 return reflect.TypeOf((*[]*DeploymentConfig)(nil)).Elem() 292 } 293 294 func (i DeploymentConfigArray) ToDeploymentConfigArrayOutput() DeploymentConfigArrayOutput { 295 return i.ToDeploymentConfigArrayOutputWithContext(context.Background()) 296 } 297 298 func (i DeploymentConfigArray) ToDeploymentConfigArrayOutputWithContext(ctx context.Context) DeploymentConfigArrayOutput { 299 return pulumi.ToOutputWithContext(ctx, i).(DeploymentConfigArrayOutput) 300 } 301 302 // DeploymentConfigMapInput is an input type that accepts DeploymentConfigMap and DeploymentConfigMapOutput values. 303 // You can construct a concrete instance of `DeploymentConfigMapInput` via: 304 // 305 // DeploymentConfigMap{ "key": DeploymentConfigArgs{...} } 306 type DeploymentConfigMapInput interface { 307 pulumi.Input 308 309 ToDeploymentConfigMapOutput() DeploymentConfigMapOutput 310 ToDeploymentConfigMapOutputWithContext(context.Context) DeploymentConfigMapOutput 311 } 312 313 type DeploymentConfigMap map[string]DeploymentConfigInput 314 315 func (DeploymentConfigMap) ElementType() reflect.Type { 316 return reflect.TypeOf((*map[string]*DeploymentConfig)(nil)).Elem() 317 } 318 319 func (i DeploymentConfigMap) ToDeploymentConfigMapOutput() DeploymentConfigMapOutput { 320 return i.ToDeploymentConfigMapOutputWithContext(context.Background()) 321 } 322 323 func (i DeploymentConfigMap) ToDeploymentConfigMapOutputWithContext(ctx context.Context) DeploymentConfigMapOutput { 324 return pulumi.ToOutputWithContext(ctx, i).(DeploymentConfigMapOutput) 325 } 326 327 type DeploymentConfigOutput struct{ *pulumi.OutputState } 328 329 func (DeploymentConfigOutput) ElementType() reflect.Type { 330 return reflect.TypeOf((**DeploymentConfig)(nil)).Elem() 331 } 332 333 func (o DeploymentConfigOutput) ToDeploymentConfigOutput() DeploymentConfigOutput { 334 return o 335 } 336 337 func (o DeploymentConfigOutput) ToDeploymentConfigOutputWithContext(ctx context.Context) DeploymentConfigOutput { 338 return o 339 } 340 341 // The ARN of the deployment config. 342 func (o DeploymentConfigOutput) Arn() pulumi.StringOutput { 343 return o.ApplyT(func(v *DeploymentConfig) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 344 } 345 346 // The compute platform can be `Server`, `Lambda`, or `ECS`. Default is `Server`. 347 func (o DeploymentConfigOutput) ComputePlatform() pulumi.StringPtrOutput { 348 return o.ApplyT(func(v *DeploymentConfig) pulumi.StringPtrOutput { return v.ComputePlatform }).(pulumi.StringPtrOutput) 349 } 350 351 // The AWS Assigned deployment config id 352 func (o DeploymentConfigOutput) DeploymentConfigId() pulumi.StringOutput { 353 return o.ApplyT(func(v *DeploymentConfig) pulumi.StringOutput { return v.DeploymentConfigId }).(pulumi.StringOutput) 354 } 355 356 // The name of the deployment config. 357 func (o DeploymentConfigOutput) DeploymentConfigName() pulumi.StringOutput { 358 return o.ApplyT(func(v *DeploymentConfig) pulumi.StringOutput { return v.DeploymentConfigName }).(pulumi.StringOutput) 359 } 360 361 // A minimumHealthyHosts block. Required for `Server` compute platform. Minimum Healthy Hosts are documented below. 362 func (o DeploymentConfigOutput) MinimumHealthyHosts() DeploymentConfigMinimumHealthyHostsPtrOutput { 363 return o.ApplyT(func(v *DeploymentConfig) DeploymentConfigMinimumHealthyHostsPtrOutput { return v.MinimumHealthyHosts }).(DeploymentConfigMinimumHealthyHostsPtrOutput) 364 } 365 366 // A trafficRoutingConfig block. Traffic Routing Config is documented below. 367 func (o DeploymentConfigOutput) TrafficRoutingConfig() DeploymentConfigTrafficRoutingConfigPtrOutput { 368 return o.ApplyT(func(v *DeploymentConfig) DeploymentConfigTrafficRoutingConfigPtrOutput { return v.TrafficRoutingConfig }).(DeploymentConfigTrafficRoutingConfigPtrOutput) 369 } 370 371 type DeploymentConfigArrayOutput struct{ *pulumi.OutputState } 372 373 func (DeploymentConfigArrayOutput) ElementType() reflect.Type { 374 return reflect.TypeOf((*[]*DeploymentConfig)(nil)).Elem() 375 } 376 377 func (o DeploymentConfigArrayOutput) ToDeploymentConfigArrayOutput() DeploymentConfigArrayOutput { 378 return o 379 } 380 381 func (o DeploymentConfigArrayOutput) ToDeploymentConfigArrayOutputWithContext(ctx context.Context) DeploymentConfigArrayOutput { 382 return o 383 } 384 385 func (o DeploymentConfigArrayOutput) Index(i pulumi.IntInput) DeploymentConfigOutput { 386 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *DeploymentConfig { 387 return vs[0].([]*DeploymentConfig)[vs[1].(int)] 388 }).(DeploymentConfigOutput) 389 } 390 391 type DeploymentConfigMapOutput struct{ *pulumi.OutputState } 392 393 func (DeploymentConfigMapOutput) ElementType() reflect.Type { 394 return reflect.TypeOf((*map[string]*DeploymentConfig)(nil)).Elem() 395 } 396 397 func (o DeploymentConfigMapOutput) ToDeploymentConfigMapOutput() DeploymentConfigMapOutput { 398 return o 399 } 400 401 func (o DeploymentConfigMapOutput) ToDeploymentConfigMapOutputWithContext(ctx context.Context) DeploymentConfigMapOutput { 402 return o 403 } 404 405 func (o DeploymentConfigMapOutput) MapIndex(k pulumi.StringInput) DeploymentConfigOutput { 406 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *DeploymentConfig { 407 return vs[0].(map[string]*DeploymentConfig)[vs[1].(string)] 408 }).(DeploymentConfigOutput) 409 } 410 411 func init() { 412 pulumi.RegisterInputType(reflect.TypeOf((*DeploymentConfigInput)(nil)).Elem(), &DeploymentConfig{}) 413 pulumi.RegisterInputType(reflect.TypeOf((*DeploymentConfigArrayInput)(nil)).Elem(), DeploymentConfigArray{}) 414 pulumi.RegisterInputType(reflect.TypeOf((*DeploymentConfigMapInput)(nil)).Elem(), DeploymentConfigMap{}) 415 pulumi.RegisterOutputType(DeploymentConfigOutput{}) 416 pulumi.RegisterOutputType(DeploymentConfigArrayOutput{}) 417 pulumi.RegisterOutputType(DeploymentConfigMapOutput{}) 418 }