allow update

This commit is contained in:
jba 2015-02-18 10:45:12 +01:00
parent 101f801846
commit 372035368f
2 changed files with 24 additions and 7 deletions

View File

@ -13,22 +13,25 @@ import (
func resourceAwsVpcPeeringConnection() *schema.Resource { func resourceAwsVpcPeeringConnection() *schema.Resource {
return &schema.Resource{ return &schema.Resource{
Create: resourceAwsVpcPeeringCreate, Create: resourceAwsVpcPeeringCreate,
Read: resourceAwsVpcPeeringConnectionRead, Read: resourceAwsVpcPeeringRead,
Update: nil, Update: resourceAwsVpcPeeringUpdate,
Delete: resourceAwsVpcPeeringDelete, Delete: resourceAwsVpcPeeringDelete,
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"peer_owner_id": &schema.Schema{ "peer_owner_id": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Required: true, Required: true,
ForceNew: true,
}, },
"peer_vpc_id": &schema.Schema{ "peer_vpc_id": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Required: true, Required: true,
ForceNew: true,
}, },
"vpc_id": &schema.Schema{ "vpc_id": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Required: true, Required: true,
ForceNew: true,
}, },
"tags": tagsSchema(), "tags": tagsSchema(),
}, },
@ -74,7 +77,7 @@ func resourceAwsVpcPeeringCreate(d *schema.ResourceData, meta interface{}) error
return nil return nil
} }
func resourceAwsVpcPeeringConnectionRead(d *schema.ResourceData, meta interface{}) error { func resourceAwsVpcPeeringRead(d *schema.ResourceData, meta interface{}) error {
ec2conn := meta.(*AWSClient).ec2conn ec2conn := meta.(*AWSClient).ec2conn
pcRaw, _, err := resourceAwsVpcPeeringConnectionStateRefreshFunc(ec2conn, d.Id())() pcRaw, _, err := resourceAwsVpcPeeringConnectionStateRefreshFunc(ec2conn, d.Id())()
if err != nil { if err != nil {
@ -94,6 +97,19 @@ func resourceAwsVpcPeeringConnectionRead(d *schema.ResourceData, meta interface{
return nil return nil
} }
func resourceAwsVpcPeeringUpdate(d *schema.ResourceData, meta interface{}) error {
ec2conn := meta.(*AWSClient).ec2conn
if err := setTags(ec2conn, d); err != nil {
return err
} else {
d.SetPartial("tags")
}
return resourceAwsRouteTableRead(d, meta)
}
func resourceAwsVpcPeeringDelete(d *schema.ResourceData, meta interface{}) error { func resourceAwsVpcPeeringDelete(d *schema.ResourceData, meta interface{}) error {
ec2conn := meta.(*AWSClient).ec2conn ec2conn := meta.(*AWSClient).ec2conn

View File

@ -48,11 +48,12 @@ The following arguments are supported:
* `vpc_id` - (Required) The ID of the requester VPC. * `vpc_id` - (Required) The ID of the requester VPC.
* `tags` - (Optional) A mapping of tags to assign to the resource. * `tags` - (Optional) A mapping of tags to assign to the resource.
Note: You still have to accept the peering with the aws console, aws-cli or goamz
## Attributes Reference ## Attributes Reference
The following attributes are exported: The following attributes are exported:
* `id` - The ID of the VPC Peering Connection * `id` - The ID of the VPC Peering Connectiona
## Notes
You still have to accept the peering with the aws console, aws-cli or goamz