github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/shield/protectionHealthCheckAssociation.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 shield 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 // Creates an association between a Route53 Health Check and a Shield Advanced protected resource. 16 // This association uses the health of your applications to improve responsiveness and accuracy in attack detection and mitigation. 17 // 18 // Blog post: [AWS Shield Advanced now supports Health Based Detection](https://aws.amazon.com/about-aws/whats-new/2020/02/aws-shield-advanced-now-supports-health-based-detection/) 19 // 20 // ## Example Usage 21 // 22 // ### Create an association between a protected EIP and a Route53 Health Check 23 // 24 // <!--Start PulumiCodeChooser --> 25 // ```go 26 // package main 27 // 28 // import ( 29 // 30 // "fmt" 31 // 32 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws" 33 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 34 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53" 35 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/shield" 36 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 37 // 38 // ) 39 // 40 // func main() { 41 // pulumi.Run(func(ctx *pulumi.Context) error { 42 // current, err := aws.GetRegion(ctx, nil, nil) 43 // if err != nil { 44 // return err 45 // } 46 // currentGetCallerIdentity, err := aws.GetCallerIdentity(ctx, nil, nil) 47 // if err != nil { 48 // return err 49 // } 50 // currentGetPartition, err := aws.GetPartition(ctx, nil, nil) 51 // if err != nil { 52 // return err 53 // } 54 // example, err := ec2.NewEip(ctx, "example", &ec2.EipArgs{ 55 // Domain: pulumi.String("vpc"), 56 // Tags: pulumi.StringMap{ 57 // "Name": pulumi.String("example"), 58 // }, 59 // }) 60 // if err != nil { 61 // return err 62 // } 63 // exampleProtection, err := shield.NewProtection(ctx, "example", &shield.ProtectionArgs{ 64 // Name: pulumi.String("example-protection"), 65 // ResourceArn: example.ID().ApplyT(func(id string) (string, error) { 66 // return fmt.Sprintf("arn:%v:ec2:%v:%v:eip-allocation/%v", currentGetPartition.Partition, current.Name, currentGetCallerIdentity.AccountId, id), nil 67 // }).(pulumi.StringOutput), 68 // }) 69 // if err != nil { 70 // return err 71 // } 72 // exampleHealthCheck, err := route53.NewHealthCheck(ctx, "example", &route53.HealthCheckArgs{ 73 // IpAddress: example.PublicIp, 74 // Port: pulumi.Int(80), 75 // Type: pulumi.String("HTTP"), 76 // ResourcePath: pulumi.String("/ready"), 77 // FailureThreshold: pulumi.Int(3), 78 // RequestInterval: pulumi.Int(30), 79 // Tags: pulumi.StringMap{ 80 // "Name": pulumi.String("tf-example-health-check"), 81 // }, 82 // }) 83 // if err != nil { 84 // return err 85 // } 86 // _, err = shield.NewProtectionHealthCheckAssociation(ctx, "example", &shield.ProtectionHealthCheckAssociationArgs{ 87 // HealthCheckArn: exampleHealthCheck.Arn, 88 // ShieldProtectionId: exampleProtection.ID(), 89 // }) 90 // if err != nil { 91 // return err 92 // } 93 // return nil 94 // }) 95 // } 96 // 97 // ``` 98 // <!--End PulumiCodeChooser --> 99 // 100 // ## Import 101 // 102 // Using `pulumi import`, import Shield protection health check association resources using the `shield_protection_id` and `health_check_arn`. For example: 103 // 104 // ```sh 105 // $ pulumi import aws:shield/protectionHealthCheckAssociation:ProtectionHealthCheckAssociation example ff9592dc-22f3-4e88-afa1-7b29fde9669a+arn:aws:route53:::healthcheck/3742b175-edb9-46bc-9359-f53e3b794b1b 106 // ``` 107 type ProtectionHealthCheckAssociation struct { 108 pulumi.CustomResourceState 109 110 // The ARN (Amazon Resource Name) of the Route53 Health Check resource which will be associated to the protected resource. 111 HealthCheckArn pulumi.StringOutput `pulumi:"healthCheckArn"` 112 // The ID of the protected resource. 113 ShieldProtectionId pulumi.StringOutput `pulumi:"shieldProtectionId"` 114 } 115 116 // NewProtectionHealthCheckAssociation registers a new resource with the given unique name, arguments, and options. 117 func NewProtectionHealthCheckAssociation(ctx *pulumi.Context, 118 name string, args *ProtectionHealthCheckAssociationArgs, opts ...pulumi.ResourceOption) (*ProtectionHealthCheckAssociation, error) { 119 if args == nil { 120 return nil, errors.New("missing one or more required arguments") 121 } 122 123 if args.HealthCheckArn == nil { 124 return nil, errors.New("invalid value for required argument 'HealthCheckArn'") 125 } 126 if args.ShieldProtectionId == nil { 127 return nil, errors.New("invalid value for required argument 'ShieldProtectionId'") 128 } 129 opts = internal.PkgResourceDefaultOpts(opts) 130 var resource ProtectionHealthCheckAssociation 131 err := ctx.RegisterResource("aws:shield/protectionHealthCheckAssociation:ProtectionHealthCheckAssociation", name, args, &resource, opts...) 132 if err != nil { 133 return nil, err 134 } 135 return &resource, nil 136 } 137 138 // GetProtectionHealthCheckAssociation gets an existing ProtectionHealthCheckAssociation resource's state with the given name, ID, and optional 139 // state properties that are used to uniquely qualify the lookup (nil if not required). 140 func GetProtectionHealthCheckAssociation(ctx *pulumi.Context, 141 name string, id pulumi.IDInput, state *ProtectionHealthCheckAssociationState, opts ...pulumi.ResourceOption) (*ProtectionHealthCheckAssociation, error) { 142 var resource ProtectionHealthCheckAssociation 143 err := ctx.ReadResource("aws:shield/protectionHealthCheckAssociation:ProtectionHealthCheckAssociation", name, id, state, &resource, opts...) 144 if err != nil { 145 return nil, err 146 } 147 return &resource, nil 148 } 149 150 // Input properties used for looking up and filtering ProtectionHealthCheckAssociation resources. 151 type protectionHealthCheckAssociationState struct { 152 // The ARN (Amazon Resource Name) of the Route53 Health Check resource which will be associated to the protected resource. 153 HealthCheckArn *string `pulumi:"healthCheckArn"` 154 // The ID of the protected resource. 155 ShieldProtectionId *string `pulumi:"shieldProtectionId"` 156 } 157 158 type ProtectionHealthCheckAssociationState struct { 159 // The ARN (Amazon Resource Name) of the Route53 Health Check resource which will be associated to the protected resource. 160 HealthCheckArn pulumi.StringPtrInput 161 // The ID of the protected resource. 162 ShieldProtectionId pulumi.StringPtrInput 163 } 164 165 func (ProtectionHealthCheckAssociationState) ElementType() reflect.Type { 166 return reflect.TypeOf((*protectionHealthCheckAssociationState)(nil)).Elem() 167 } 168 169 type protectionHealthCheckAssociationArgs struct { 170 // The ARN (Amazon Resource Name) of the Route53 Health Check resource which will be associated to the protected resource. 171 HealthCheckArn string `pulumi:"healthCheckArn"` 172 // The ID of the protected resource. 173 ShieldProtectionId string `pulumi:"shieldProtectionId"` 174 } 175 176 // The set of arguments for constructing a ProtectionHealthCheckAssociation resource. 177 type ProtectionHealthCheckAssociationArgs struct { 178 // The ARN (Amazon Resource Name) of the Route53 Health Check resource which will be associated to the protected resource. 179 HealthCheckArn pulumi.StringInput 180 // The ID of the protected resource. 181 ShieldProtectionId pulumi.StringInput 182 } 183 184 func (ProtectionHealthCheckAssociationArgs) ElementType() reflect.Type { 185 return reflect.TypeOf((*protectionHealthCheckAssociationArgs)(nil)).Elem() 186 } 187 188 type ProtectionHealthCheckAssociationInput interface { 189 pulumi.Input 190 191 ToProtectionHealthCheckAssociationOutput() ProtectionHealthCheckAssociationOutput 192 ToProtectionHealthCheckAssociationOutputWithContext(ctx context.Context) ProtectionHealthCheckAssociationOutput 193 } 194 195 func (*ProtectionHealthCheckAssociation) ElementType() reflect.Type { 196 return reflect.TypeOf((**ProtectionHealthCheckAssociation)(nil)).Elem() 197 } 198 199 func (i *ProtectionHealthCheckAssociation) ToProtectionHealthCheckAssociationOutput() ProtectionHealthCheckAssociationOutput { 200 return i.ToProtectionHealthCheckAssociationOutputWithContext(context.Background()) 201 } 202 203 func (i *ProtectionHealthCheckAssociation) ToProtectionHealthCheckAssociationOutputWithContext(ctx context.Context) ProtectionHealthCheckAssociationOutput { 204 return pulumi.ToOutputWithContext(ctx, i).(ProtectionHealthCheckAssociationOutput) 205 } 206 207 // ProtectionHealthCheckAssociationArrayInput is an input type that accepts ProtectionHealthCheckAssociationArray and ProtectionHealthCheckAssociationArrayOutput values. 208 // You can construct a concrete instance of `ProtectionHealthCheckAssociationArrayInput` via: 209 // 210 // ProtectionHealthCheckAssociationArray{ ProtectionHealthCheckAssociationArgs{...} } 211 type ProtectionHealthCheckAssociationArrayInput interface { 212 pulumi.Input 213 214 ToProtectionHealthCheckAssociationArrayOutput() ProtectionHealthCheckAssociationArrayOutput 215 ToProtectionHealthCheckAssociationArrayOutputWithContext(context.Context) ProtectionHealthCheckAssociationArrayOutput 216 } 217 218 type ProtectionHealthCheckAssociationArray []ProtectionHealthCheckAssociationInput 219 220 func (ProtectionHealthCheckAssociationArray) ElementType() reflect.Type { 221 return reflect.TypeOf((*[]*ProtectionHealthCheckAssociation)(nil)).Elem() 222 } 223 224 func (i ProtectionHealthCheckAssociationArray) ToProtectionHealthCheckAssociationArrayOutput() ProtectionHealthCheckAssociationArrayOutput { 225 return i.ToProtectionHealthCheckAssociationArrayOutputWithContext(context.Background()) 226 } 227 228 func (i ProtectionHealthCheckAssociationArray) ToProtectionHealthCheckAssociationArrayOutputWithContext(ctx context.Context) ProtectionHealthCheckAssociationArrayOutput { 229 return pulumi.ToOutputWithContext(ctx, i).(ProtectionHealthCheckAssociationArrayOutput) 230 } 231 232 // ProtectionHealthCheckAssociationMapInput is an input type that accepts ProtectionHealthCheckAssociationMap and ProtectionHealthCheckAssociationMapOutput values. 233 // You can construct a concrete instance of `ProtectionHealthCheckAssociationMapInput` via: 234 // 235 // ProtectionHealthCheckAssociationMap{ "key": ProtectionHealthCheckAssociationArgs{...} } 236 type ProtectionHealthCheckAssociationMapInput interface { 237 pulumi.Input 238 239 ToProtectionHealthCheckAssociationMapOutput() ProtectionHealthCheckAssociationMapOutput 240 ToProtectionHealthCheckAssociationMapOutputWithContext(context.Context) ProtectionHealthCheckAssociationMapOutput 241 } 242 243 type ProtectionHealthCheckAssociationMap map[string]ProtectionHealthCheckAssociationInput 244 245 func (ProtectionHealthCheckAssociationMap) ElementType() reflect.Type { 246 return reflect.TypeOf((*map[string]*ProtectionHealthCheckAssociation)(nil)).Elem() 247 } 248 249 func (i ProtectionHealthCheckAssociationMap) ToProtectionHealthCheckAssociationMapOutput() ProtectionHealthCheckAssociationMapOutput { 250 return i.ToProtectionHealthCheckAssociationMapOutputWithContext(context.Background()) 251 } 252 253 func (i ProtectionHealthCheckAssociationMap) ToProtectionHealthCheckAssociationMapOutputWithContext(ctx context.Context) ProtectionHealthCheckAssociationMapOutput { 254 return pulumi.ToOutputWithContext(ctx, i).(ProtectionHealthCheckAssociationMapOutput) 255 } 256 257 type ProtectionHealthCheckAssociationOutput struct{ *pulumi.OutputState } 258 259 func (ProtectionHealthCheckAssociationOutput) ElementType() reflect.Type { 260 return reflect.TypeOf((**ProtectionHealthCheckAssociation)(nil)).Elem() 261 } 262 263 func (o ProtectionHealthCheckAssociationOutput) ToProtectionHealthCheckAssociationOutput() ProtectionHealthCheckAssociationOutput { 264 return o 265 } 266 267 func (o ProtectionHealthCheckAssociationOutput) ToProtectionHealthCheckAssociationOutputWithContext(ctx context.Context) ProtectionHealthCheckAssociationOutput { 268 return o 269 } 270 271 // The ARN (Amazon Resource Name) of the Route53 Health Check resource which will be associated to the protected resource. 272 func (o ProtectionHealthCheckAssociationOutput) HealthCheckArn() pulumi.StringOutput { 273 return o.ApplyT(func(v *ProtectionHealthCheckAssociation) pulumi.StringOutput { return v.HealthCheckArn }).(pulumi.StringOutput) 274 } 275 276 // The ID of the protected resource. 277 func (o ProtectionHealthCheckAssociationOutput) ShieldProtectionId() pulumi.StringOutput { 278 return o.ApplyT(func(v *ProtectionHealthCheckAssociation) pulumi.StringOutput { return v.ShieldProtectionId }).(pulumi.StringOutput) 279 } 280 281 type ProtectionHealthCheckAssociationArrayOutput struct{ *pulumi.OutputState } 282 283 func (ProtectionHealthCheckAssociationArrayOutput) ElementType() reflect.Type { 284 return reflect.TypeOf((*[]*ProtectionHealthCheckAssociation)(nil)).Elem() 285 } 286 287 func (o ProtectionHealthCheckAssociationArrayOutput) ToProtectionHealthCheckAssociationArrayOutput() ProtectionHealthCheckAssociationArrayOutput { 288 return o 289 } 290 291 func (o ProtectionHealthCheckAssociationArrayOutput) ToProtectionHealthCheckAssociationArrayOutputWithContext(ctx context.Context) ProtectionHealthCheckAssociationArrayOutput { 292 return o 293 } 294 295 func (o ProtectionHealthCheckAssociationArrayOutput) Index(i pulumi.IntInput) ProtectionHealthCheckAssociationOutput { 296 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ProtectionHealthCheckAssociation { 297 return vs[0].([]*ProtectionHealthCheckAssociation)[vs[1].(int)] 298 }).(ProtectionHealthCheckAssociationOutput) 299 } 300 301 type ProtectionHealthCheckAssociationMapOutput struct{ *pulumi.OutputState } 302 303 func (ProtectionHealthCheckAssociationMapOutput) ElementType() reflect.Type { 304 return reflect.TypeOf((*map[string]*ProtectionHealthCheckAssociation)(nil)).Elem() 305 } 306 307 func (o ProtectionHealthCheckAssociationMapOutput) ToProtectionHealthCheckAssociationMapOutput() ProtectionHealthCheckAssociationMapOutput { 308 return o 309 } 310 311 func (o ProtectionHealthCheckAssociationMapOutput) ToProtectionHealthCheckAssociationMapOutputWithContext(ctx context.Context) ProtectionHealthCheckAssociationMapOutput { 312 return o 313 } 314 315 func (o ProtectionHealthCheckAssociationMapOutput) MapIndex(k pulumi.StringInput) ProtectionHealthCheckAssociationOutput { 316 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ProtectionHealthCheckAssociation { 317 return vs[0].(map[string]*ProtectionHealthCheckAssociation)[vs[1].(string)] 318 }).(ProtectionHealthCheckAssociationOutput) 319 } 320 321 func init() { 322 pulumi.RegisterInputType(reflect.TypeOf((*ProtectionHealthCheckAssociationInput)(nil)).Elem(), &ProtectionHealthCheckAssociation{}) 323 pulumi.RegisterInputType(reflect.TypeOf((*ProtectionHealthCheckAssociationArrayInput)(nil)).Elem(), ProtectionHealthCheckAssociationArray{}) 324 pulumi.RegisterInputType(reflect.TypeOf((*ProtectionHealthCheckAssociationMapInput)(nil)).Elem(), ProtectionHealthCheckAssociationMap{}) 325 pulumi.RegisterOutputType(ProtectionHealthCheckAssociationOutput{}) 326 pulumi.RegisterOutputType(ProtectionHealthCheckAssociationArrayOutput{}) 327 pulumi.RegisterOutputType(ProtectionHealthCheckAssociationMapOutput{}) 328 }