github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ram/resourceAssociation.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 ram 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 // Manages a Resource Access Manager (RAM) Resource Association. 16 // 17 // > *NOTE:* Certain AWS resources (e.g., EC2 Subnets) can only be shared in an AWS account that is a member of an AWS Organizations organization with organization-wide Resource Access Manager functionality enabled. See the [Resource Access Manager User Guide](https://docs.aws.amazon.com/ram/latest/userguide/what-is.html) and AWS service specific documentation for additional information. 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/ram" 28 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 29 // 30 // ) 31 // 32 // func main() { 33 // pulumi.Run(func(ctx *pulumi.Context) error { 34 // _, err := ram.NewResourceAssociation(ctx, "example", &ram.ResourceAssociationArgs{ 35 // ResourceArn: pulumi.Any(exampleAwsSubnet.Arn), 36 // ResourceShareArn: pulumi.Any(exampleAwsRamResourceShare.Arn), 37 // }) 38 // if err != nil { 39 // return err 40 // } 41 // return nil 42 // }) 43 // } 44 // 45 // ``` 46 // <!--End PulumiCodeChooser --> 47 // 48 // ## Import 49 // 50 // Using `pulumi import`, import RAM Resource Associations using their Resource Share ARN and Resource ARN separated by a comma. For example: 51 // 52 // ```sh 53 // $ pulumi import aws:ram/resourceAssociation:ResourceAssociation example arn:aws:ram:eu-west-1:123456789012:resource-share/73da1ab9-b94a-4ba3-8eb4-45917f7f4b12,arn:aws:ec2:eu-west-1:123456789012:subnet/subnet-12345678 54 // ``` 55 type ResourceAssociation struct { 56 pulumi.CustomResourceState 57 58 // Amazon Resource Name (ARN) of the resource to associate with the RAM Resource Share. 59 ResourceArn pulumi.StringOutput `pulumi:"resourceArn"` 60 // Amazon Resource Name (ARN) of the RAM Resource Share. 61 ResourceShareArn pulumi.StringOutput `pulumi:"resourceShareArn"` 62 } 63 64 // NewResourceAssociation registers a new resource with the given unique name, arguments, and options. 65 func NewResourceAssociation(ctx *pulumi.Context, 66 name string, args *ResourceAssociationArgs, opts ...pulumi.ResourceOption) (*ResourceAssociation, error) { 67 if args == nil { 68 return nil, errors.New("missing one or more required arguments") 69 } 70 71 if args.ResourceArn == nil { 72 return nil, errors.New("invalid value for required argument 'ResourceArn'") 73 } 74 if args.ResourceShareArn == nil { 75 return nil, errors.New("invalid value for required argument 'ResourceShareArn'") 76 } 77 opts = internal.PkgResourceDefaultOpts(opts) 78 var resource ResourceAssociation 79 err := ctx.RegisterResource("aws:ram/resourceAssociation:ResourceAssociation", name, args, &resource, opts...) 80 if err != nil { 81 return nil, err 82 } 83 return &resource, nil 84 } 85 86 // GetResourceAssociation gets an existing ResourceAssociation resource's state with the given name, ID, and optional 87 // state properties that are used to uniquely qualify the lookup (nil if not required). 88 func GetResourceAssociation(ctx *pulumi.Context, 89 name string, id pulumi.IDInput, state *ResourceAssociationState, opts ...pulumi.ResourceOption) (*ResourceAssociation, error) { 90 var resource ResourceAssociation 91 err := ctx.ReadResource("aws:ram/resourceAssociation:ResourceAssociation", name, id, state, &resource, opts...) 92 if err != nil { 93 return nil, err 94 } 95 return &resource, nil 96 } 97 98 // Input properties used for looking up and filtering ResourceAssociation resources. 99 type resourceAssociationState struct { 100 // Amazon Resource Name (ARN) of the resource to associate with the RAM Resource Share. 101 ResourceArn *string `pulumi:"resourceArn"` 102 // Amazon Resource Name (ARN) of the RAM Resource Share. 103 ResourceShareArn *string `pulumi:"resourceShareArn"` 104 } 105 106 type ResourceAssociationState struct { 107 // Amazon Resource Name (ARN) of the resource to associate with the RAM Resource Share. 108 ResourceArn pulumi.StringPtrInput 109 // Amazon Resource Name (ARN) of the RAM Resource Share. 110 ResourceShareArn pulumi.StringPtrInput 111 } 112 113 func (ResourceAssociationState) ElementType() reflect.Type { 114 return reflect.TypeOf((*resourceAssociationState)(nil)).Elem() 115 } 116 117 type resourceAssociationArgs struct { 118 // Amazon Resource Name (ARN) of the resource to associate with the RAM Resource Share. 119 ResourceArn string `pulumi:"resourceArn"` 120 // Amazon Resource Name (ARN) of the RAM Resource Share. 121 ResourceShareArn string `pulumi:"resourceShareArn"` 122 } 123 124 // The set of arguments for constructing a ResourceAssociation resource. 125 type ResourceAssociationArgs struct { 126 // Amazon Resource Name (ARN) of the resource to associate with the RAM Resource Share. 127 ResourceArn pulumi.StringInput 128 // Amazon Resource Name (ARN) of the RAM Resource Share. 129 ResourceShareArn pulumi.StringInput 130 } 131 132 func (ResourceAssociationArgs) ElementType() reflect.Type { 133 return reflect.TypeOf((*resourceAssociationArgs)(nil)).Elem() 134 } 135 136 type ResourceAssociationInput interface { 137 pulumi.Input 138 139 ToResourceAssociationOutput() ResourceAssociationOutput 140 ToResourceAssociationOutputWithContext(ctx context.Context) ResourceAssociationOutput 141 } 142 143 func (*ResourceAssociation) ElementType() reflect.Type { 144 return reflect.TypeOf((**ResourceAssociation)(nil)).Elem() 145 } 146 147 func (i *ResourceAssociation) ToResourceAssociationOutput() ResourceAssociationOutput { 148 return i.ToResourceAssociationOutputWithContext(context.Background()) 149 } 150 151 func (i *ResourceAssociation) ToResourceAssociationOutputWithContext(ctx context.Context) ResourceAssociationOutput { 152 return pulumi.ToOutputWithContext(ctx, i).(ResourceAssociationOutput) 153 } 154 155 // ResourceAssociationArrayInput is an input type that accepts ResourceAssociationArray and ResourceAssociationArrayOutput values. 156 // You can construct a concrete instance of `ResourceAssociationArrayInput` via: 157 // 158 // ResourceAssociationArray{ ResourceAssociationArgs{...} } 159 type ResourceAssociationArrayInput interface { 160 pulumi.Input 161 162 ToResourceAssociationArrayOutput() ResourceAssociationArrayOutput 163 ToResourceAssociationArrayOutputWithContext(context.Context) ResourceAssociationArrayOutput 164 } 165 166 type ResourceAssociationArray []ResourceAssociationInput 167 168 func (ResourceAssociationArray) ElementType() reflect.Type { 169 return reflect.TypeOf((*[]*ResourceAssociation)(nil)).Elem() 170 } 171 172 func (i ResourceAssociationArray) ToResourceAssociationArrayOutput() ResourceAssociationArrayOutput { 173 return i.ToResourceAssociationArrayOutputWithContext(context.Background()) 174 } 175 176 func (i ResourceAssociationArray) ToResourceAssociationArrayOutputWithContext(ctx context.Context) ResourceAssociationArrayOutput { 177 return pulumi.ToOutputWithContext(ctx, i).(ResourceAssociationArrayOutput) 178 } 179 180 // ResourceAssociationMapInput is an input type that accepts ResourceAssociationMap and ResourceAssociationMapOutput values. 181 // You can construct a concrete instance of `ResourceAssociationMapInput` via: 182 // 183 // ResourceAssociationMap{ "key": ResourceAssociationArgs{...} } 184 type ResourceAssociationMapInput interface { 185 pulumi.Input 186 187 ToResourceAssociationMapOutput() ResourceAssociationMapOutput 188 ToResourceAssociationMapOutputWithContext(context.Context) ResourceAssociationMapOutput 189 } 190 191 type ResourceAssociationMap map[string]ResourceAssociationInput 192 193 func (ResourceAssociationMap) ElementType() reflect.Type { 194 return reflect.TypeOf((*map[string]*ResourceAssociation)(nil)).Elem() 195 } 196 197 func (i ResourceAssociationMap) ToResourceAssociationMapOutput() ResourceAssociationMapOutput { 198 return i.ToResourceAssociationMapOutputWithContext(context.Background()) 199 } 200 201 func (i ResourceAssociationMap) ToResourceAssociationMapOutputWithContext(ctx context.Context) ResourceAssociationMapOutput { 202 return pulumi.ToOutputWithContext(ctx, i).(ResourceAssociationMapOutput) 203 } 204 205 type ResourceAssociationOutput struct{ *pulumi.OutputState } 206 207 func (ResourceAssociationOutput) ElementType() reflect.Type { 208 return reflect.TypeOf((**ResourceAssociation)(nil)).Elem() 209 } 210 211 func (o ResourceAssociationOutput) ToResourceAssociationOutput() ResourceAssociationOutput { 212 return o 213 } 214 215 func (o ResourceAssociationOutput) ToResourceAssociationOutputWithContext(ctx context.Context) ResourceAssociationOutput { 216 return o 217 } 218 219 // Amazon Resource Name (ARN) of the resource to associate with the RAM Resource Share. 220 func (o ResourceAssociationOutput) ResourceArn() pulumi.StringOutput { 221 return o.ApplyT(func(v *ResourceAssociation) pulumi.StringOutput { return v.ResourceArn }).(pulumi.StringOutput) 222 } 223 224 // Amazon Resource Name (ARN) of the RAM Resource Share. 225 func (o ResourceAssociationOutput) ResourceShareArn() pulumi.StringOutput { 226 return o.ApplyT(func(v *ResourceAssociation) pulumi.StringOutput { return v.ResourceShareArn }).(pulumi.StringOutput) 227 } 228 229 type ResourceAssociationArrayOutput struct{ *pulumi.OutputState } 230 231 func (ResourceAssociationArrayOutput) ElementType() reflect.Type { 232 return reflect.TypeOf((*[]*ResourceAssociation)(nil)).Elem() 233 } 234 235 func (o ResourceAssociationArrayOutput) ToResourceAssociationArrayOutput() ResourceAssociationArrayOutput { 236 return o 237 } 238 239 func (o ResourceAssociationArrayOutput) ToResourceAssociationArrayOutputWithContext(ctx context.Context) ResourceAssociationArrayOutput { 240 return o 241 } 242 243 func (o ResourceAssociationArrayOutput) Index(i pulumi.IntInput) ResourceAssociationOutput { 244 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ResourceAssociation { 245 return vs[0].([]*ResourceAssociation)[vs[1].(int)] 246 }).(ResourceAssociationOutput) 247 } 248 249 type ResourceAssociationMapOutput struct{ *pulumi.OutputState } 250 251 func (ResourceAssociationMapOutput) ElementType() reflect.Type { 252 return reflect.TypeOf((*map[string]*ResourceAssociation)(nil)).Elem() 253 } 254 255 func (o ResourceAssociationMapOutput) ToResourceAssociationMapOutput() ResourceAssociationMapOutput { 256 return o 257 } 258 259 func (o ResourceAssociationMapOutput) ToResourceAssociationMapOutputWithContext(ctx context.Context) ResourceAssociationMapOutput { 260 return o 261 } 262 263 func (o ResourceAssociationMapOutput) MapIndex(k pulumi.StringInput) ResourceAssociationOutput { 264 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ResourceAssociation { 265 return vs[0].(map[string]*ResourceAssociation)[vs[1].(string)] 266 }).(ResourceAssociationOutput) 267 } 268 269 func init() { 270 pulumi.RegisterInputType(reflect.TypeOf((*ResourceAssociationInput)(nil)).Elem(), &ResourceAssociation{}) 271 pulumi.RegisterInputType(reflect.TypeOf((*ResourceAssociationArrayInput)(nil)).Elem(), ResourceAssociationArray{}) 272 pulumi.RegisterInputType(reflect.TypeOf((*ResourceAssociationMapInput)(nil)).Elem(), ResourceAssociationMap{}) 273 pulumi.RegisterOutputType(ResourceAssociationOutput{}) 274 pulumi.RegisterOutputType(ResourceAssociationArrayOutput{}) 275 pulumi.RegisterOutputType(ResourceAssociationMapOutput{}) 276 }