github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/vpcDhcpOptionsAssociation.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 a VPC DHCP Options Association resource. 16 // 17 // ## Example Usage 18 // 19 // <!--Start PulumiCodeChooser --> 20 // ```go 21 // package main 22 // 23 // import ( 24 // 25 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 26 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 27 // 28 // ) 29 // 30 // func main() { 31 // pulumi.Run(func(ctx *pulumi.Context) error { 32 // _, err := ec2.NewVpcDhcpOptionsAssociation(ctx, "dns_resolver", &ec2.VpcDhcpOptionsAssociationArgs{ 33 // VpcId: pulumi.Any(fooAwsVpc.Id), 34 // DhcpOptionsId: pulumi.Any(foo.Id), 35 // }) 36 // if err != nil { 37 // return err 38 // } 39 // return nil 40 // }) 41 // } 42 // 43 // ``` 44 // <!--End PulumiCodeChooser --> 45 // 46 // ## Remarks 47 // 48 // * You can only associate one DHCP Options Set to a given VPC ID. 49 // * Removing the DHCP Options Association automatically sets AWS's `default` DHCP Options Set to the VPC. 50 // 51 // ## Import 52 // 53 // Using `pulumi import`, import DHCP associations using the VPC ID associated with the options. For example: 54 // 55 // ```sh 56 // $ pulumi import aws:ec2/vpcDhcpOptionsAssociation:VpcDhcpOptionsAssociation imported vpc-0f001273ec18911b1 57 // ``` 58 type VpcDhcpOptionsAssociation struct { 59 pulumi.CustomResourceState 60 61 // The ID of the DHCP Options Set to associate to the VPC. 62 DhcpOptionsId pulumi.StringOutput `pulumi:"dhcpOptionsId"` 63 // The ID of the VPC to which we would like to associate a DHCP Options Set. 64 VpcId pulumi.StringOutput `pulumi:"vpcId"` 65 } 66 67 // NewVpcDhcpOptionsAssociation registers a new resource with the given unique name, arguments, and options. 68 func NewVpcDhcpOptionsAssociation(ctx *pulumi.Context, 69 name string, args *VpcDhcpOptionsAssociationArgs, opts ...pulumi.ResourceOption) (*VpcDhcpOptionsAssociation, error) { 70 if args == nil { 71 return nil, errors.New("missing one or more required arguments") 72 } 73 74 if args.DhcpOptionsId == nil { 75 return nil, errors.New("invalid value for required argument 'DhcpOptionsId'") 76 } 77 if args.VpcId == nil { 78 return nil, errors.New("invalid value for required argument 'VpcId'") 79 } 80 opts = internal.PkgResourceDefaultOpts(opts) 81 var resource VpcDhcpOptionsAssociation 82 err := ctx.RegisterResource("aws:ec2/vpcDhcpOptionsAssociation:VpcDhcpOptionsAssociation", name, args, &resource, opts...) 83 if err != nil { 84 return nil, err 85 } 86 return &resource, nil 87 } 88 89 // GetVpcDhcpOptionsAssociation gets an existing VpcDhcpOptionsAssociation resource's state with the given name, ID, and optional 90 // state properties that are used to uniquely qualify the lookup (nil if not required). 91 func GetVpcDhcpOptionsAssociation(ctx *pulumi.Context, 92 name string, id pulumi.IDInput, state *VpcDhcpOptionsAssociationState, opts ...pulumi.ResourceOption) (*VpcDhcpOptionsAssociation, error) { 93 var resource VpcDhcpOptionsAssociation 94 err := ctx.ReadResource("aws:ec2/vpcDhcpOptionsAssociation:VpcDhcpOptionsAssociation", name, id, state, &resource, opts...) 95 if err != nil { 96 return nil, err 97 } 98 return &resource, nil 99 } 100 101 // Input properties used for looking up and filtering VpcDhcpOptionsAssociation resources. 102 type vpcDhcpOptionsAssociationState struct { 103 // The ID of the DHCP Options Set to associate to the VPC. 104 DhcpOptionsId *string `pulumi:"dhcpOptionsId"` 105 // The ID of the VPC to which we would like to associate a DHCP Options Set. 106 VpcId *string `pulumi:"vpcId"` 107 } 108 109 type VpcDhcpOptionsAssociationState struct { 110 // The ID of the DHCP Options Set to associate to the VPC. 111 DhcpOptionsId pulumi.StringPtrInput 112 // The ID of the VPC to which we would like to associate a DHCP Options Set. 113 VpcId pulumi.StringPtrInput 114 } 115 116 func (VpcDhcpOptionsAssociationState) ElementType() reflect.Type { 117 return reflect.TypeOf((*vpcDhcpOptionsAssociationState)(nil)).Elem() 118 } 119 120 type vpcDhcpOptionsAssociationArgs struct { 121 // The ID of the DHCP Options Set to associate to the VPC. 122 DhcpOptionsId string `pulumi:"dhcpOptionsId"` 123 // The ID of the VPC to which we would like to associate a DHCP Options Set. 124 VpcId string `pulumi:"vpcId"` 125 } 126 127 // The set of arguments for constructing a VpcDhcpOptionsAssociation resource. 128 type VpcDhcpOptionsAssociationArgs struct { 129 // The ID of the DHCP Options Set to associate to the VPC. 130 DhcpOptionsId pulumi.StringInput 131 // The ID of the VPC to which we would like to associate a DHCP Options Set. 132 VpcId pulumi.StringInput 133 } 134 135 func (VpcDhcpOptionsAssociationArgs) ElementType() reflect.Type { 136 return reflect.TypeOf((*vpcDhcpOptionsAssociationArgs)(nil)).Elem() 137 } 138 139 type VpcDhcpOptionsAssociationInput interface { 140 pulumi.Input 141 142 ToVpcDhcpOptionsAssociationOutput() VpcDhcpOptionsAssociationOutput 143 ToVpcDhcpOptionsAssociationOutputWithContext(ctx context.Context) VpcDhcpOptionsAssociationOutput 144 } 145 146 func (*VpcDhcpOptionsAssociation) ElementType() reflect.Type { 147 return reflect.TypeOf((**VpcDhcpOptionsAssociation)(nil)).Elem() 148 } 149 150 func (i *VpcDhcpOptionsAssociation) ToVpcDhcpOptionsAssociationOutput() VpcDhcpOptionsAssociationOutput { 151 return i.ToVpcDhcpOptionsAssociationOutputWithContext(context.Background()) 152 } 153 154 func (i *VpcDhcpOptionsAssociation) ToVpcDhcpOptionsAssociationOutputWithContext(ctx context.Context) VpcDhcpOptionsAssociationOutput { 155 return pulumi.ToOutputWithContext(ctx, i).(VpcDhcpOptionsAssociationOutput) 156 } 157 158 // VpcDhcpOptionsAssociationArrayInput is an input type that accepts VpcDhcpOptionsAssociationArray and VpcDhcpOptionsAssociationArrayOutput values. 159 // You can construct a concrete instance of `VpcDhcpOptionsAssociationArrayInput` via: 160 // 161 // VpcDhcpOptionsAssociationArray{ VpcDhcpOptionsAssociationArgs{...} } 162 type VpcDhcpOptionsAssociationArrayInput interface { 163 pulumi.Input 164 165 ToVpcDhcpOptionsAssociationArrayOutput() VpcDhcpOptionsAssociationArrayOutput 166 ToVpcDhcpOptionsAssociationArrayOutputWithContext(context.Context) VpcDhcpOptionsAssociationArrayOutput 167 } 168 169 type VpcDhcpOptionsAssociationArray []VpcDhcpOptionsAssociationInput 170 171 func (VpcDhcpOptionsAssociationArray) ElementType() reflect.Type { 172 return reflect.TypeOf((*[]*VpcDhcpOptionsAssociation)(nil)).Elem() 173 } 174 175 func (i VpcDhcpOptionsAssociationArray) ToVpcDhcpOptionsAssociationArrayOutput() VpcDhcpOptionsAssociationArrayOutput { 176 return i.ToVpcDhcpOptionsAssociationArrayOutputWithContext(context.Background()) 177 } 178 179 func (i VpcDhcpOptionsAssociationArray) ToVpcDhcpOptionsAssociationArrayOutputWithContext(ctx context.Context) VpcDhcpOptionsAssociationArrayOutput { 180 return pulumi.ToOutputWithContext(ctx, i).(VpcDhcpOptionsAssociationArrayOutput) 181 } 182 183 // VpcDhcpOptionsAssociationMapInput is an input type that accepts VpcDhcpOptionsAssociationMap and VpcDhcpOptionsAssociationMapOutput values. 184 // You can construct a concrete instance of `VpcDhcpOptionsAssociationMapInput` via: 185 // 186 // VpcDhcpOptionsAssociationMap{ "key": VpcDhcpOptionsAssociationArgs{...} } 187 type VpcDhcpOptionsAssociationMapInput interface { 188 pulumi.Input 189 190 ToVpcDhcpOptionsAssociationMapOutput() VpcDhcpOptionsAssociationMapOutput 191 ToVpcDhcpOptionsAssociationMapOutputWithContext(context.Context) VpcDhcpOptionsAssociationMapOutput 192 } 193 194 type VpcDhcpOptionsAssociationMap map[string]VpcDhcpOptionsAssociationInput 195 196 func (VpcDhcpOptionsAssociationMap) ElementType() reflect.Type { 197 return reflect.TypeOf((*map[string]*VpcDhcpOptionsAssociation)(nil)).Elem() 198 } 199 200 func (i VpcDhcpOptionsAssociationMap) ToVpcDhcpOptionsAssociationMapOutput() VpcDhcpOptionsAssociationMapOutput { 201 return i.ToVpcDhcpOptionsAssociationMapOutputWithContext(context.Background()) 202 } 203 204 func (i VpcDhcpOptionsAssociationMap) ToVpcDhcpOptionsAssociationMapOutputWithContext(ctx context.Context) VpcDhcpOptionsAssociationMapOutput { 205 return pulumi.ToOutputWithContext(ctx, i).(VpcDhcpOptionsAssociationMapOutput) 206 } 207 208 type VpcDhcpOptionsAssociationOutput struct{ *pulumi.OutputState } 209 210 func (VpcDhcpOptionsAssociationOutput) ElementType() reflect.Type { 211 return reflect.TypeOf((**VpcDhcpOptionsAssociation)(nil)).Elem() 212 } 213 214 func (o VpcDhcpOptionsAssociationOutput) ToVpcDhcpOptionsAssociationOutput() VpcDhcpOptionsAssociationOutput { 215 return o 216 } 217 218 func (o VpcDhcpOptionsAssociationOutput) ToVpcDhcpOptionsAssociationOutputWithContext(ctx context.Context) VpcDhcpOptionsAssociationOutput { 219 return o 220 } 221 222 // The ID of the DHCP Options Set to associate to the VPC. 223 func (o VpcDhcpOptionsAssociationOutput) DhcpOptionsId() pulumi.StringOutput { 224 return o.ApplyT(func(v *VpcDhcpOptionsAssociation) pulumi.StringOutput { return v.DhcpOptionsId }).(pulumi.StringOutput) 225 } 226 227 // The ID of the VPC to which we would like to associate a DHCP Options Set. 228 func (o VpcDhcpOptionsAssociationOutput) VpcId() pulumi.StringOutput { 229 return o.ApplyT(func(v *VpcDhcpOptionsAssociation) pulumi.StringOutput { return v.VpcId }).(pulumi.StringOutput) 230 } 231 232 type VpcDhcpOptionsAssociationArrayOutput struct{ *pulumi.OutputState } 233 234 func (VpcDhcpOptionsAssociationArrayOutput) ElementType() reflect.Type { 235 return reflect.TypeOf((*[]*VpcDhcpOptionsAssociation)(nil)).Elem() 236 } 237 238 func (o VpcDhcpOptionsAssociationArrayOutput) ToVpcDhcpOptionsAssociationArrayOutput() VpcDhcpOptionsAssociationArrayOutput { 239 return o 240 } 241 242 func (o VpcDhcpOptionsAssociationArrayOutput) ToVpcDhcpOptionsAssociationArrayOutputWithContext(ctx context.Context) VpcDhcpOptionsAssociationArrayOutput { 243 return o 244 } 245 246 func (o VpcDhcpOptionsAssociationArrayOutput) Index(i pulumi.IntInput) VpcDhcpOptionsAssociationOutput { 247 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *VpcDhcpOptionsAssociation { 248 return vs[0].([]*VpcDhcpOptionsAssociation)[vs[1].(int)] 249 }).(VpcDhcpOptionsAssociationOutput) 250 } 251 252 type VpcDhcpOptionsAssociationMapOutput struct{ *pulumi.OutputState } 253 254 func (VpcDhcpOptionsAssociationMapOutput) ElementType() reflect.Type { 255 return reflect.TypeOf((*map[string]*VpcDhcpOptionsAssociation)(nil)).Elem() 256 } 257 258 func (o VpcDhcpOptionsAssociationMapOutput) ToVpcDhcpOptionsAssociationMapOutput() VpcDhcpOptionsAssociationMapOutput { 259 return o 260 } 261 262 func (o VpcDhcpOptionsAssociationMapOutput) ToVpcDhcpOptionsAssociationMapOutputWithContext(ctx context.Context) VpcDhcpOptionsAssociationMapOutput { 263 return o 264 } 265 266 func (o VpcDhcpOptionsAssociationMapOutput) MapIndex(k pulumi.StringInput) VpcDhcpOptionsAssociationOutput { 267 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *VpcDhcpOptionsAssociation { 268 return vs[0].(map[string]*VpcDhcpOptionsAssociation)[vs[1].(string)] 269 }).(VpcDhcpOptionsAssociationOutput) 270 } 271 272 func init() { 273 pulumi.RegisterInputType(reflect.TypeOf((*VpcDhcpOptionsAssociationInput)(nil)).Elem(), &VpcDhcpOptionsAssociation{}) 274 pulumi.RegisterInputType(reflect.TypeOf((*VpcDhcpOptionsAssociationArrayInput)(nil)).Elem(), VpcDhcpOptionsAssociationArray{}) 275 pulumi.RegisterInputType(reflect.TypeOf((*VpcDhcpOptionsAssociationMapInput)(nil)).Elem(), VpcDhcpOptionsAssociationMap{}) 276 pulumi.RegisterOutputType(VpcDhcpOptionsAssociationOutput{}) 277 pulumi.RegisterOutputType(VpcDhcpOptionsAssociationArrayOutput{}) 278 pulumi.RegisterOutputType(VpcDhcpOptionsAssociationMapOutput{}) 279 }