-
Notifications
You must be signed in to change notification settings - Fork 8.9k
/
resource_aws_vpc_peering_connection_accepter.go
73 lines (64 loc) · 1.72 KB
/
resource_aws_vpc_peering_connection_accepter.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
package aws
import (
"log"
"fmt"
"github.com/hashicorp/terraform/helper/schema"
)
func resourceAwsVpcPeeringConnectionAccepter() *schema.Resource {
return &schema.Resource{
Create: resourceAwsVPCPeeringAccepterCreate,
Read: resourceAwsVPCPeeringRead,
Update: resourceAwsVPCPeeringUpdate,
Delete: resourceAwsVPCPeeringAccepterDelete,
Schema: map[string]*schema.Schema{
"vpc_peering_connection_id": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Computed: false,
},
"auto_accept": {
Type: schema.TypeBool,
Optional: true,
},
"accept_status": {
Type: schema.TypeString,
Computed: true,
},
"vpc_id": {
Type: schema.TypeString,
Computed: true,
},
"peer_vpc_id": {
Type: schema.TypeString,
Computed: true,
},
"peer_owner_id": {
Type: schema.TypeString,
Computed: true,
},
"peer_region": {
Type: schema.TypeString,
Computed: true,
},
"accepter": vpcPeeringConnectionOptionsSchema(),
"requester": vpcPeeringConnectionOptionsSchema(),
"tags": tagsSchema(),
},
}
}
func resourceAwsVPCPeeringAccepterCreate(d *schema.ResourceData, meta interface{}) error {
id := d.Get("vpc_peering_connection_id").(string)
d.SetId(id)
if err := resourceAwsVPCPeeringRead(d, meta); err != nil {
return err
}
if d.Id() == "" {
return fmt.Errorf("VPC Peering Connection %q not found", id)
}
return resourceAwsVPCPeeringUpdate(d, meta)
}
func resourceAwsVPCPeeringAccepterDelete(d *schema.ResourceData, meta interface{}) error {
log.Printf("[WARN] Will not delete VPC peering connection. Terraform will remove this resource from the state file, however resources may remain.")
return nil
}