From 18814655f8f3ab28da87c97abcf87da62b683b34 Mon Sep 17 00:00:00 2001 From: Ayu Demura Date: Wed, 27 Jul 2016 12:10:36 -0400 Subject: [PATCH] wip --- .../packet/resource_packet_ip_address.go | 40 +++---------------- .../packet/resource_packet_ip_reservation.go | 39 +++++------------- .../resource_packet_ip_reservation_test.go | 6 ++- .../packet/resource_packet_volume.go | 5 +++ 4 files changed, 25 insertions(+), 65 deletions(-) diff --git a/builtin/providers/packet/resource_packet_ip_address.go b/builtin/providers/packet/resource_packet_ip_address.go index 0b76fcd16..3bffdf443 100644 --- a/builtin/providers/packet/resource_packet_ip_address.go +++ b/builtin/providers/packet/resource_packet_ip_address.go @@ -12,47 +12,17 @@ func resourcePacketIPAddress() *schema.Resource { Delete: resourcePacketIPAddressDelete, Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "address": &schema.Schema{ Type: schema.TypeString, Required: true, ForceNew: true, }, - "gateway": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - }, - - "network": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - }, - - "family": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - }, - - "netmask": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - }, - - "cidr": &schema.Schema{ - Type: schema.TypeInt, - Computed: true, - }, - - "public": &schema.Schema{ - Type: schema.TypeBool, - Computed: true, - }, - - "assigned_to": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - }, - "created": &schema.Schema{ Type: schema.TypeString, Computed: true, diff --git a/builtin/providers/packet/resource_packet_ip_reservation.go b/builtin/providers/packet/resource_packet_ip_reservation.go index 14d327b80..286df050b 100644 --- a/builtin/providers/packet/resource_packet_ip_reservation.go +++ b/builtin/providers/packet/resource_packet_ip_reservation.go @@ -12,44 +12,27 @@ func resourcePacketIPReservation() *schema.Resource { Delete: resourcePacketIPReservationDelete, Schema: map[string]*schema.Schema{ - "address": &schema.Schema{ + "id": &schema.Schema{ Type: schema.TypeString, Computed: true, }, - "gateway": &schema.Schema{ + "type": &schema.Schema{ Type: schema.TypeString, - Computed: true, + Required: true, + ForceNew: true, }, - "network": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - }, - - "family": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - }, - - "netmask": &schema.Schema{ + "quantity": &schema.Schema{ Type: schema.TypeInt, - Computed: true, + Optional: true, + ForceNew: true, }, - "cidr": &schema.Schema{ - Type: schema.TypeInt, - Computed: true, - }, - - "public": &schema.Schema{ - Type: schema.TypeBool, - Computed: true, - }, - - "assigned_to": &schema.Schema{ - Type: schema.TypeBool, - Computed: true, + "comments": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ForceNew: true, }, "created": &schema.Schema{ diff --git a/builtin/providers/packet/resource_packet_ip_reservation_test.go b/builtin/providers/packet/resource_packet_ip_reservation_test.go index b47963977..6c2c962fa 100644 --- a/builtin/providers/packet/resource_packet_ip_reservation_test.go +++ b/builtin/providers/packet/resource_packet_ip_reservation_test.go @@ -23,7 +23,7 @@ func TestAccPacketIPReservation_Basic(t *testing.T) { testAccCheckPacketIPReservationExists("packet_ip_reservation.foobar", &ip_reservation), testAccCheckPacketIPReservationAttributes(&ip_reservation), resource.TestCheckResourceAttr( - "packet_ip_reservation", "foobar", "{}"), + "packet_ip_reservation.foobar", "type", "foobar"), ), }, }, @@ -81,4 +81,6 @@ func testAccCheckPacketIPReservationExists(n string, ip_reservation *packngo.IPR } var testAccCheckPacketIPReservationConfig_basic = fmt.Sprintf(` -resource "packet_ip_reservation" "foobar" {}`) +resource "packet_ip_reservation" "foobar" { + type = "foobar" +}`) diff --git a/builtin/providers/packet/resource_packet_volume.go b/builtin/providers/packet/resource_packet_volume.go index 0b121557c..d212a1561 100644 --- a/builtin/providers/packet/resource_packet_volume.go +++ b/builtin/providers/packet/resource_packet_volume.go @@ -15,6 +15,11 @@ func resourcePacketVolume() *schema.Resource { Delete: resourcePacketVolumeDelete, Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "project_id": &schema.Schema{ Type: schema.TypeString, Required: true,