-
Notifications
You must be signed in to change notification settings - Fork 151
/
resourceShareAccepter.go
382 lines (321 loc) · 15.3 KB
/
resourceShareAccepter.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package ram
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manage accepting a Resource Access Manager (RAM) Resource Share invitation. From a _receiver_ AWS account, accept an invitation to share resources that were shared by a _sender_ AWS account. To create a resource share in the _sender_, see the `ram.ResourceShare` resource.
//
// > **Note:** If both AWS accounts are in the same Organization and [RAM Sharing with AWS Organizations is enabled](https://docs.aws.amazon.com/ram/latest/userguide/getting-started-sharing.html#getting-started-sharing-orgs), this resource is not necessary as RAM Resource Share invitations are not used.
//
// ## Example Usage
//
// This configuration provides an example of using multiple AWS providers to configure two different AWS accounts. In the _sender_ account, the configuration creates a `ram.ResourceShare` and uses a data source in the _receiver_ account to create a `ram.PrincipalAssociation` resource with the _receiver's_ account ID. In the _receiver_ account, the configuration accepts the invitation to share resources with the `ram.ResourceShareAccepter`.
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws"
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/providers"
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ram"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := providers.Newaws(ctx, "alternate", &providers.awsArgs{
// Profile: "profile1",
// })
// if err != nil {
// return err
// }
// senderShare, err := ram.NewResourceShare(ctx, "senderShare", &ram.ResourceShareArgs{
// AllowExternalPrincipals: pulumi.Bool(true),
// Tags: pulumi.StringMap{
// "Name": pulumi.String("tf-test-resource-share"),
// },
// }, pulumi.Provider(aws.Alternate))
// if err != nil {
// return err
// }
// receiver, err := aws.GetCallerIdentity(ctx, nil, nil)
// if err != nil {
// return err
// }
// senderInvite, err := ram.NewPrincipalAssociation(ctx, "senderInvite", &ram.PrincipalAssociationArgs{
// Principal: pulumi.String(receiver.AccountId),
// ResourceShareArn: senderShare.Arn,
// }, pulumi.Provider(aws.Alternate))
// if err != nil {
// return err
// }
// _, err = ram.NewResourceShareAccepter(ctx, "receiverAccept", &ram.ResourceShareAccepterArgs{
// ShareArn: senderInvite.ResourceShareArn,
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Resource share accepters can be imported using the resource share ARN, e.g.,
//
// ```sh
// $ pulumi import aws:ram/resourceShareAccepter:ResourceShareAccepter example arn:aws:ram:us-east-1:123456789012:resource-share/c4b56393-e8d9-89d9-6dc9-883752de4767
// ```
type ResourceShareAccepter struct {
pulumi.CustomResourceState
// The ARN of the resource share invitation.
InvitationArn pulumi.StringOutput `pulumi:"invitationArn"`
// The account ID of the receiver account which accepts the invitation.
ReceiverAccountId pulumi.StringOutput `pulumi:"receiverAccountId"`
// A list of the resource ARNs shared via the resource share.
Resources pulumi.StringArrayOutput `pulumi:"resources"`
// The account ID of the sender account which submits the invitation.
SenderAccountId pulumi.StringOutput `pulumi:"senderAccountId"`
// The ARN of the resource share.
ShareArn pulumi.StringOutput `pulumi:"shareArn"`
// The ID of the resource share as displayed in the console.
ShareId pulumi.StringOutput `pulumi:"shareId"`
// The name of the resource share.
ShareName pulumi.StringOutput `pulumi:"shareName"`
// The status of the resource share (ACTIVE, PENDING, FAILED, DELETING, DELETED).
Status pulumi.StringOutput `pulumi:"status"`
}
// NewResourceShareAccepter registers a new resource with the given unique name, arguments, and options.
func NewResourceShareAccepter(ctx *pulumi.Context,
name string, args *ResourceShareAccepterArgs, opts ...pulumi.ResourceOption) (*ResourceShareAccepter, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ShareArn == nil {
return nil, errors.New("invalid value for required argument 'ShareArn'")
}
var resource ResourceShareAccepter
err := ctx.RegisterResource("aws:ram/resourceShareAccepter:ResourceShareAccepter", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetResourceShareAccepter gets an existing ResourceShareAccepter resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetResourceShareAccepter(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ResourceShareAccepterState, opts ...pulumi.ResourceOption) (*ResourceShareAccepter, error) {
var resource ResourceShareAccepter
err := ctx.ReadResource("aws:ram/resourceShareAccepter:ResourceShareAccepter", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ResourceShareAccepter resources.
type resourceShareAccepterState struct {
// The ARN of the resource share invitation.
InvitationArn *string `pulumi:"invitationArn"`
// The account ID of the receiver account which accepts the invitation.
ReceiverAccountId *string `pulumi:"receiverAccountId"`
// A list of the resource ARNs shared via the resource share.
Resources []string `pulumi:"resources"`
// The account ID of the sender account which submits the invitation.
SenderAccountId *string `pulumi:"senderAccountId"`
// The ARN of the resource share.
ShareArn *string `pulumi:"shareArn"`
// The ID of the resource share as displayed in the console.
ShareId *string `pulumi:"shareId"`
// The name of the resource share.
ShareName *string `pulumi:"shareName"`
// The status of the resource share (ACTIVE, PENDING, FAILED, DELETING, DELETED).
Status *string `pulumi:"status"`
}
type ResourceShareAccepterState struct {
// The ARN of the resource share invitation.
InvitationArn pulumi.StringPtrInput
// The account ID of the receiver account which accepts the invitation.
ReceiverAccountId pulumi.StringPtrInput
// A list of the resource ARNs shared via the resource share.
Resources pulumi.StringArrayInput
// The account ID of the sender account which submits the invitation.
SenderAccountId pulumi.StringPtrInput
// The ARN of the resource share.
ShareArn pulumi.StringPtrInput
// The ID of the resource share as displayed in the console.
ShareId pulumi.StringPtrInput
// The name of the resource share.
ShareName pulumi.StringPtrInput
// The status of the resource share (ACTIVE, PENDING, FAILED, DELETING, DELETED).
Status pulumi.StringPtrInput
}
func (ResourceShareAccepterState) ElementType() reflect.Type {
return reflect.TypeOf((*resourceShareAccepterState)(nil)).Elem()
}
type resourceShareAccepterArgs struct {
// The ARN of the resource share.
ShareArn string `pulumi:"shareArn"`
}
// The set of arguments for constructing a ResourceShareAccepter resource.
type ResourceShareAccepterArgs struct {
// The ARN of the resource share.
ShareArn pulumi.StringInput
}
func (ResourceShareAccepterArgs) ElementType() reflect.Type {
return reflect.TypeOf((*resourceShareAccepterArgs)(nil)).Elem()
}
type ResourceShareAccepterInput interface {
pulumi.Input
ToResourceShareAccepterOutput() ResourceShareAccepterOutput
ToResourceShareAccepterOutputWithContext(ctx context.Context) ResourceShareAccepterOutput
}
func (*ResourceShareAccepter) ElementType() reflect.Type {
return reflect.TypeOf((*ResourceShareAccepter)(nil))
}
func (i *ResourceShareAccepter) ToResourceShareAccepterOutput() ResourceShareAccepterOutput {
return i.ToResourceShareAccepterOutputWithContext(context.Background())
}
func (i *ResourceShareAccepter) ToResourceShareAccepterOutputWithContext(ctx context.Context) ResourceShareAccepterOutput {
return pulumi.ToOutputWithContext(ctx, i).(ResourceShareAccepterOutput)
}
func (i *ResourceShareAccepter) ToResourceShareAccepterPtrOutput() ResourceShareAccepterPtrOutput {
return i.ToResourceShareAccepterPtrOutputWithContext(context.Background())
}
func (i *ResourceShareAccepter) ToResourceShareAccepterPtrOutputWithContext(ctx context.Context) ResourceShareAccepterPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(ResourceShareAccepterPtrOutput)
}
type ResourceShareAccepterPtrInput interface {
pulumi.Input
ToResourceShareAccepterPtrOutput() ResourceShareAccepterPtrOutput
ToResourceShareAccepterPtrOutputWithContext(ctx context.Context) ResourceShareAccepterPtrOutput
}
type resourceShareAccepterPtrType ResourceShareAccepterArgs
func (*resourceShareAccepterPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**ResourceShareAccepter)(nil))
}
func (i *resourceShareAccepterPtrType) ToResourceShareAccepterPtrOutput() ResourceShareAccepterPtrOutput {
return i.ToResourceShareAccepterPtrOutputWithContext(context.Background())
}
func (i *resourceShareAccepterPtrType) ToResourceShareAccepterPtrOutputWithContext(ctx context.Context) ResourceShareAccepterPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(ResourceShareAccepterPtrOutput)
}
// ResourceShareAccepterArrayInput is an input type that accepts ResourceShareAccepterArray and ResourceShareAccepterArrayOutput values.
// You can construct a concrete instance of `ResourceShareAccepterArrayInput` via:
//
// ResourceShareAccepterArray{ ResourceShareAccepterArgs{...} }
type ResourceShareAccepterArrayInput interface {
pulumi.Input
ToResourceShareAccepterArrayOutput() ResourceShareAccepterArrayOutput
ToResourceShareAccepterArrayOutputWithContext(context.Context) ResourceShareAccepterArrayOutput
}
type ResourceShareAccepterArray []ResourceShareAccepterInput
func (ResourceShareAccepterArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ResourceShareAccepter)(nil)).Elem()
}
func (i ResourceShareAccepterArray) ToResourceShareAccepterArrayOutput() ResourceShareAccepterArrayOutput {
return i.ToResourceShareAccepterArrayOutputWithContext(context.Background())
}
func (i ResourceShareAccepterArray) ToResourceShareAccepterArrayOutputWithContext(ctx context.Context) ResourceShareAccepterArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ResourceShareAccepterArrayOutput)
}
// ResourceShareAccepterMapInput is an input type that accepts ResourceShareAccepterMap and ResourceShareAccepterMapOutput values.
// You can construct a concrete instance of `ResourceShareAccepterMapInput` via:
//
// ResourceShareAccepterMap{ "key": ResourceShareAccepterArgs{...} }
type ResourceShareAccepterMapInput interface {
pulumi.Input
ToResourceShareAccepterMapOutput() ResourceShareAccepterMapOutput
ToResourceShareAccepterMapOutputWithContext(context.Context) ResourceShareAccepterMapOutput
}
type ResourceShareAccepterMap map[string]ResourceShareAccepterInput
func (ResourceShareAccepterMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ResourceShareAccepter)(nil)).Elem()
}
func (i ResourceShareAccepterMap) ToResourceShareAccepterMapOutput() ResourceShareAccepterMapOutput {
return i.ToResourceShareAccepterMapOutputWithContext(context.Background())
}
func (i ResourceShareAccepterMap) ToResourceShareAccepterMapOutputWithContext(ctx context.Context) ResourceShareAccepterMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ResourceShareAccepterMapOutput)
}
type ResourceShareAccepterOutput struct{ *pulumi.OutputState }
func (ResourceShareAccepterOutput) ElementType() reflect.Type {
return reflect.TypeOf((*ResourceShareAccepter)(nil))
}
func (o ResourceShareAccepterOutput) ToResourceShareAccepterOutput() ResourceShareAccepterOutput {
return o
}
func (o ResourceShareAccepterOutput) ToResourceShareAccepterOutputWithContext(ctx context.Context) ResourceShareAccepterOutput {
return o
}
func (o ResourceShareAccepterOutput) ToResourceShareAccepterPtrOutput() ResourceShareAccepterPtrOutput {
return o.ToResourceShareAccepterPtrOutputWithContext(context.Background())
}
func (o ResourceShareAccepterOutput) ToResourceShareAccepterPtrOutputWithContext(ctx context.Context) ResourceShareAccepterPtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, v ResourceShareAccepter) *ResourceShareAccepter {
return &v
}).(ResourceShareAccepterPtrOutput)
}
type ResourceShareAccepterPtrOutput struct{ *pulumi.OutputState }
func (ResourceShareAccepterPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ResourceShareAccepter)(nil))
}
func (o ResourceShareAccepterPtrOutput) ToResourceShareAccepterPtrOutput() ResourceShareAccepterPtrOutput {
return o
}
func (o ResourceShareAccepterPtrOutput) ToResourceShareAccepterPtrOutputWithContext(ctx context.Context) ResourceShareAccepterPtrOutput {
return o
}
func (o ResourceShareAccepterPtrOutput) Elem() ResourceShareAccepterOutput {
return o.ApplyT(func(v *ResourceShareAccepter) ResourceShareAccepter {
if v != nil {
return *v
}
var ret ResourceShareAccepter
return ret
}).(ResourceShareAccepterOutput)
}
type ResourceShareAccepterArrayOutput struct{ *pulumi.OutputState }
func (ResourceShareAccepterArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]ResourceShareAccepter)(nil))
}
func (o ResourceShareAccepterArrayOutput) ToResourceShareAccepterArrayOutput() ResourceShareAccepterArrayOutput {
return o
}
func (o ResourceShareAccepterArrayOutput) ToResourceShareAccepterArrayOutputWithContext(ctx context.Context) ResourceShareAccepterArrayOutput {
return o
}
func (o ResourceShareAccepterArrayOutput) Index(i pulumi.IntInput) ResourceShareAccepterOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) ResourceShareAccepter {
return vs[0].([]ResourceShareAccepter)[vs[1].(int)]
}).(ResourceShareAccepterOutput)
}
type ResourceShareAccepterMapOutput struct{ *pulumi.OutputState }
func (ResourceShareAccepterMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]ResourceShareAccepter)(nil))
}
func (o ResourceShareAccepterMapOutput) ToResourceShareAccepterMapOutput() ResourceShareAccepterMapOutput {
return o
}
func (o ResourceShareAccepterMapOutput) ToResourceShareAccepterMapOutputWithContext(ctx context.Context) ResourceShareAccepterMapOutput {
return o
}
func (o ResourceShareAccepterMapOutput) MapIndex(k pulumi.StringInput) ResourceShareAccepterOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) ResourceShareAccepter {
return vs[0].(map[string]ResourceShareAccepter)[vs[1].(string)]
}).(ResourceShareAccepterOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ResourceShareAccepterInput)(nil)).Elem(), &ResourceShareAccepter{})
pulumi.RegisterInputType(reflect.TypeOf((*ResourceShareAccepterPtrInput)(nil)).Elem(), &ResourceShareAccepter{})
pulumi.RegisterInputType(reflect.TypeOf((*ResourceShareAccepterArrayInput)(nil)).Elem(), ResourceShareAccepterArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ResourceShareAccepterMapInput)(nil)).Elem(), ResourceShareAccepterMap{})
pulumi.RegisterOutputType(ResourceShareAccepterOutput{})
pulumi.RegisterOutputType(ResourceShareAccepterPtrOutput{})
pulumi.RegisterOutputType(ResourceShareAccepterArrayOutput{})
pulumi.RegisterOutputType(ResourceShareAccepterMapOutput{})
}