Merge pull request #6010 from svanharmelen/f-deprecate-ipaddress

provider/cloudstack: make the CloudStack provider more inline with the other providers
This commit is contained in:
Sander van Harmelen 2016-04-05 21:54:23 +02:00
commit 5e6af8e01b
22 changed files with 235 additions and 155 deletions

View File

@ -1,6 +1,7 @@
package cloudstack package cloudstack
import ( import (
"errors"
"fmt" "fmt"
"strconv" "strconv"
"strings" "strings"
@ -20,10 +21,19 @@ func resourceCloudStackFirewall() *schema.Resource {
Delete: resourceCloudStackFirewallDelete, Delete: resourceCloudStackFirewallDelete,
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"ip_address": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ConflictsWith: []string{"ipaddress"},
},
"ipaddress": &schema.Schema{ "ipaddress": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Required: true, Optional: true,
ForceNew: true, ForceNew: true,
Deprecated: "Please use the `ip_address` field instead",
ConflictsWith: []string{"ip_address"},
}, },
"managed": &schema.Schema{ "managed": &schema.Schema{
@ -99,8 +109,16 @@ func resourceCloudStackFirewallCreate(d *schema.ResourceData, meta interface{})
return err return err
} }
ipaddress, ok := d.GetOk("ip_address")
if !ok {
ipaddress, ok = d.GetOk("ipaddress")
}
if !ok {
return errors.New("Either `ip_address` or [deprecated] `ipaddress` must be provided.")
}
// Retrieve the ipaddress ID // Retrieve the ipaddress ID
ipaddressid, e := retrieveID(cs, "ipaddress", d.Get("ipaddress").(string)) ipaddressid, e := retrieveID(cs, "ip_address", ipaddress.(string))
if e != nil { if e != nil {
return e.Error() return e.Error()
} }

View File

@ -21,7 +21,7 @@ func TestAccCloudStackFirewall_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
testAccCheckCloudStackFirewallRulesExist("cloudstack_firewall.foo"), testAccCheckCloudStackFirewallRulesExist("cloudstack_firewall.foo"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "ipaddress", CLOUDSTACK_PUBLIC_IPADDRESS), "cloudstack_firewall.foo", "ip_address", CLOUDSTACK_PUBLIC_IPADDRESS),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.#", "2"), "cloudstack_firewall.foo", "rule.#", "2"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
@ -31,13 +31,13 @@ func TestAccCloudStackFirewall_basic(t *testing.T) {
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.60926170.ports.32925333", "8080"), "cloudstack_firewall.foo", "rule.60926170.ports.32925333", "8080"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.716592205.source_cidr", "10.0.0.0/24"), "cloudstack_firewall.foo", "rule.3832507136.cidr_list.3482919157", "10.0.0.0/24"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.716592205.protocol", "tcp"), "cloudstack_firewall.foo", "rule.3832507136.protocol", "tcp"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.716592205.ports.1209010669", "1000-2000"), "cloudstack_firewall.foo", "rule.3832507136.ports.1209010669", "1000-2000"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.716592205.ports.1889509032", "80"), "cloudstack_firewall.foo", "rule.3832507136.ports.1889509032", "80"),
), ),
}, },
}, },
@ -55,7 +55,7 @@ func TestAccCloudStackFirewall_update(t *testing.T) {
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
testAccCheckCloudStackFirewallRulesExist("cloudstack_firewall.foo"), testAccCheckCloudStackFirewallRulesExist("cloudstack_firewall.foo"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "ipaddress", CLOUDSTACK_PUBLIC_IPADDRESS), "cloudstack_firewall.foo", "ip_address", CLOUDSTACK_PUBLIC_IPADDRESS),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.#", "2"), "cloudstack_firewall.foo", "rule.#", "2"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
@ -65,13 +65,13 @@ func TestAccCloudStackFirewall_update(t *testing.T) {
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.60926170.ports.32925333", "8080"), "cloudstack_firewall.foo", "rule.60926170.ports.32925333", "8080"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.716592205.source_cidr", "10.0.0.0/24"), "cloudstack_firewall.foo", "rule.3832507136.cidr_list.3482919157", "10.0.0.0/24"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.716592205.protocol", "tcp"), "cloudstack_firewall.foo", "rule.3832507136.protocol", "tcp"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.716592205.ports.1209010669", "1000-2000"), "cloudstack_firewall.foo", "rule.3832507136.ports.1209010669", "1000-2000"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.716592205.ports.1889509032", "80"), "cloudstack_firewall.foo", "rule.3832507136.ports.1889509032", "80"),
), ),
}, },
@ -80,33 +80,33 @@ func TestAccCloudStackFirewall_update(t *testing.T) {
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
testAccCheckCloudStackFirewallRulesExist("cloudstack_firewall.foo"), testAccCheckCloudStackFirewallRulesExist("cloudstack_firewall.foo"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "ipaddress", CLOUDSTACK_PUBLIC_IPADDRESS), "cloudstack_firewall.foo", "ip_address", CLOUDSTACK_PUBLIC_IPADDRESS),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.#", "3"), "cloudstack_firewall.foo", "rule.#", "3"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.2207610982.cidr_list.80081744", "10.0.1.0/24"), "cloudstack_firewall.foo", "rule.2144925929.cidr_list.80081744", "10.0.1.0/24"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.2207610982.cidr_list.3482919157", "10.0.0.0/24"), "cloudstack_firewall.foo", "rule.2144925929.cidr_list.3482919157", "10.0.0.0/24"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.2207610982.protocol", "tcp"), "cloudstack_firewall.foo", "rule.2144925929.protocol", "tcp"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.2207610982.ports.32925333", "8080"), "cloudstack_firewall.foo", "rule.2144925929.ports.32925333", "8080"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.716592205.source_cidr", "10.0.0.0/24"), "cloudstack_firewall.foo", "rule.3832507136.cidr_list.3482919157", "10.0.0.0/24"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.716592205.protocol", "tcp"), "cloudstack_firewall.foo", "rule.3832507136.protocol", "tcp"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.716592205.ports.1209010669", "1000-2000"), "cloudstack_firewall.foo", "rule.3832507136.ports.1209010669", "1000-2000"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.716592205.ports.1889509032", "80"), "cloudstack_firewall.foo", "rule.3832507136.ports.1889509032", "80"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.4449157.source_cidr", "172.16.100.0/24"), "cloudstack_firewall.foo", "rule.302279047.cidr_list.2835005819", "172.16.100.0/24"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.4449157.protocol", "tcp"), "cloudstack_firewall.foo", "rule.302279047.protocol", "tcp"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.4449157.ports.1889509032", "80"), "cloudstack_firewall.foo", "rule.302279047.ports.1889509032", "80"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_firewall.foo", "rule.4449157.ports.3638101695", "443"), "cloudstack_firewall.foo", "rule.302279047.ports.3638101695", "443"),
), ),
}, },
}, },
@ -174,7 +174,7 @@ func testAccCheckCloudStackFirewallDestroy(s *terraform.State) error {
var testAccCloudStackFirewall_basic = fmt.Sprintf(` var testAccCloudStackFirewall_basic = fmt.Sprintf(`
resource "cloudstack_firewall" "foo" { resource "cloudstack_firewall" "foo" {
ipaddress = "%s" ip_address = "%s"
rule { rule {
cidr_list = ["10.0.0.0/24"] cidr_list = ["10.0.0.0/24"]
@ -183,7 +183,7 @@ resource "cloudstack_firewall" "foo" {
} }
rule { rule {
source_cidr = "10.0.0.0/24" cidr_list = ["10.0.0.0/24"]
protocol = "tcp" protocol = "tcp"
ports = ["80", "1000-2000"] ports = ["80", "1000-2000"]
} }
@ -191,7 +191,7 @@ resource "cloudstack_firewall" "foo" {
var testAccCloudStackFirewall_update = fmt.Sprintf(` var testAccCloudStackFirewall_update = fmt.Sprintf(`
resource "cloudstack_firewall" "foo" { resource "cloudstack_firewall" "foo" {
ipaddress = "%s" ip_address = "%s"
rule { rule {
cidr_list = ["10.0.0.0/24", "10.0.1.0/24"] cidr_list = ["10.0.0.0/24", "10.0.1.0/24"]
@ -200,13 +200,13 @@ resource "cloudstack_firewall" "foo" {
} }
rule { rule {
source_cidr = "10.0.0.0/24" cidr_list = ["10.0.0.0/24"]
protocol = "tcp" protocol = "tcp"
ports = ["80", "1000-2000"] ports = ["80", "1000-2000"]
} }
rule { rule {
source_cidr = "172.16.100.0/24" cidr_list = ["172.16.100.0/24"]
protocol = "tcp" protocol = "tcp"
ports = ["80", "443"] ports = ["80", "443"]
} }

View File

@ -43,11 +43,19 @@ func resourceCloudStackInstance() *schema.Resource {
ForceNew: true, ForceNew: true,
}, },
"ip_address": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"ipaddress": &schema.Schema{ "ipaddress": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Optional: true,
Computed: true, Computed: true,
ForceNew: true, ForceNew: true,
Deprecated: "Please use the `ip_address` field instead",
}, },
"template": &schema.Schema{ "template": &schema.Schema{
@ -151,8 +159,12 @@ func resourceCloudStackInstanceCreate(d *schema.ResourceData, meta interface{})
} }
// If there is a ipaddres supplied, add it to the parameter struct // If there is a ipaddres supplied, add it to the parameter struct
if ipaddres, ok := d.GetOk("ipaddress"); ok { ipaddress, ok := d.GetOk("ip_address")
p.SetIpaddress(ipaddres.(string)) if !ok {
ipaddress, ok = d.GetOk("ipaddress")
}
if ok {
p.SetIpaddress(ipaddress.(string))
} }
// If there is a project supplied, we retrieve and set the project id // If there is a project supplied, we retrieve and set the project id
@ -228,7 +240,7 @@ func resourceCloudStackInstanceRead(d *schema.ResourceData, meta interface{}) er
// Update the config // Update the config
d.Set("name", vm.Name) d.Set("name", vm.Name)
d.Set("display_name", vm.Displayname) d.Set("display_name", vm.Displayname)
d.Set("ipaddress", vm.Nic[0].Ipaddress) d.Set("ip_address", vm.Nic[0].Ipaddress)
//NB cloudstack sometimes sends back the wrong keypair name, so dont update it //NB cloudstack sometimes sends back the wrong keypair name, so dont update it
setValueOrID(d, "network", vm.Nic[0].Networkname, vm.Nic[0].Networkid) setValueOrID(d, "network", vm.Nic[0].Networkname, vm.Nic[0].Networkid)

View File

@ -82,7 +82,7 @@ func TestAccCloudStackInstance_fixedIP(t *testing.T) {
testAccCheckCloudStackInstanceExists( testAccCheckCloudStackInstanceExists(
"cloudstack_instance.foobar", &instance), "cloudstack_instance.foobar", &instance),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_instance.foobar", "ipaddress", CLOUDSTACK_NETWORK_1_IPADDRESS1), "cloudstack_instance.foobar", "ip_address", CLOUDSTACK_NETWORK_1_IPADDRESS1),
), ),
}, },
}, },
@ -267,7 +267,7 @@ resource "cloudstack_instance" "foobar" {
display_name = "terraform-test" display_name = "terraform-test"
service_offering= "%s" service_offering= "%s"
network = "%s" network = "%s"
ipaddress = "%s" ip_address = "%s"
template = "%s" template = "%s"
zone = "%s" zone = "%s"
expunge = true expunge = true
@ -288,7 +288,7 @@ resource "cloudstack_instance" "foobar" {
display_name = "terraform-test" display_name = "terraform-test"
service_offering= "%s" service_offering= "%s"
network = "%s" network = "%s"
ipaddress = "%s" ip_address = "%s"
template = "%s" template = "%s"
zone = "%s" zone = "%s"
keypair = "${cloudstack_ssh_keypair.foo.name}" keypair = "${cloudstack_ssh_keypair.foo.name}"

View File

@ -34,7 +34,7 @@ func resourceCloudStackIPAddress() *schema.Resource {
ForceNew: true, ForceNew: true,
}, },
"ipaddress": &schema.Schema{ "ip_address": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
@ -100,7 +100,7 @@ func resourceCloudStackIPAddressRead(d *schema.ResourceData, meta interface{}) e
cs := meta.(*cloudstack.CloudStackClient) cs := meta.(*cloudstack.CloudStackClient)
// Get the IP address details // Get the IP address details
f, count, err := cs.Address.GetPublicIpAddressByID(d.Id()) ip, count, err := cs.Address.GetPublicIpAddressByID(d.Id())
if err != nil { if err != nil {
if count == 0 { if count == 0 {
log.Printf( log.Printf(
@ -113,29 +113,29 @@ func resourceCloudStackIPAddressRead(d *schema.ResourceData, meta interface{}) e
} }
// Updated the IP address // Updated the IP address
d.Set("ipaddress", f.Ipaddress) d.Set("ip_address", ip.Ipaddress)
if _, ok := d.GetOk("network"); ok { if _, ok := d.GetOk("network"); ok {
// Get the network details // Get the network details
n, _, err := cs.Network.GetNetworkByID(f.Associatednetworkid) n, _, err := cs.Network.GetNetworkByID(ip.Associatednetworkid)
if err != nil { if err != nil {
return err return err
} }
setValueOrID(d, "network", n.Name, f.Associatednetworkid) setValueOrID(d, "network", n.Name, ip.Associatednetworkid)
} }
if _, ok := d.GetOk("vpc"); ok { if _, ok := d.GetOk("vpc"); ok {
// Get the VPC details // Get the VPC details
v, _, err := cs.VPC.GetVPCByID(f.Vpcid) v, _, err := cs.VPC.GetVPCByID(ip.Vpcid)
if err != nil { if err != nil {
return err return err
} }
setValueOrID(d, "vpc", v.Name, f.Vpcid) setValueOrID(d, "vpc", v.Name, ip.Vpcid)
} }
setValueOrID(d, "project", f.Project, f.Projectid) setValueOrID(d, "project", ip.Project, ip.Projectid)
return nil return nil
} }

View File

@ -1,6 +1,7 @@
package cloudstack package cloudstack
import ( import (
"errors"
"fmt" "fmt"
"log" "log"
"strings" "strings"
@ -28,10 +29,19 @@ func resourceCloudStackLoadBalancerRule() *schema.Resource {
Computed: true, Computed: true,
}, },
"ip_address": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ConflictsWith: []string{"ipaddress"},
},
"ipaddress": &schema.Schema{ "ipaddress": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Required: true, Optional: true,
ForceNew: true, ForceNew: true,
Deprecated: "Please use the `ip_address` field instead",
ConflictsWith: []string{"ip_address"},
}, },
"network": &schema.Schema{ "network": &schema.Schema{
@ -100,8 +110,16 @@ func resourceCloudStackLoadBalancerRuleCreate(d *schema.ResourceData, meta inter
p.SetNetworkid(networkid) p.SetNetworkid(networkid)
} }
ipaddress, ok := d.GetOk("ip_address")
if !ok {
ipaddress, ok = d.GetOk("ipaddress")
}
if !ok {
return errors.New("Either `ip_address` or [deprecated] `ipaddress` must be provided.")
}
// Retrieve the ipaddress ID // Retrieve the ipaddress ID
ipaddressid, e := retrieveID(cs, "ipaddress", d.Get("ipaddress").(string)) ipaddressid, e := retrieveID(cs, "ip_address", ipaddress.(string))
if e != nil { if e != nil {
return e.Error() return e.Error()
} }
@ -117,7 +135,7 @@ func resourceCloudStackLoadBalancerRuleCreate(d *schema.ResourceData, meta inter
d.SetId(r.Id) d.SetId(r.Id)
d.SetPartial("name") d.SetPartial("name")
d.SetPartial("description") d.SetPartial("description")
d.SetPartial("ipaddress") d.SetPartial("ip_address")
d.SetPartial("network") d.SetPartial("network")
d.SetPartial("algorithm") d.SetPartial("algorithm")
d.SetPartial("private_port") d.SetPartial("private_port")
@ -163,7 +181,7 @@ func resourceCloudStackLoadBalancerRuleRead(d *schema.ResourceData, meta interfa
d.Set("public_port", lb.Publicport) d.Set("public_port", lb.Publicport)
d.Set("private_port", lb.Privateport) d.Set("private_port", lb.Privateport)
setValueOrID(d, "ipaddress", lb.Publicip, lb.Publicipid) setValueOrID(d, "ip_address", lb.Publicip, lb.Publicipid)
// Only set network if user specified it to avoid spurious diffs // Only set network if user specified it to avoid spurious diffs
if _, ok := d.GetOk("network"); ok { if _, ok := d.GetOk("network"); ok {

View File

@ -251,24 +251,12 @@ resource "cloudstack_instance" "foobar1" {
resource "cloudstack_loadbalancer_rule" "foo" { resource "cloudstack_loadbalancer_rule" "foo" {
name = "terraform-lb" name = "terraform-lb"
ipaddress = "%s" ip_address = "%s"
# network omitted, inferred from IP
algorithm = "roundrobin" algorithm = "roundrobin"
public_port = 80 public_port = 80
private_port = 80 private_port = 80
members = ["${cloudstack_instance.foobar1.id}"] members = ["${cloudstack_instance.foobar1.id}"]
} }
# attempt to create dependent firewall rule
# this will clash if cloudstack creates the implicit rule as it does by default
resource "cloudstack_firewall" "foo" {
ipaddress = "${cloudstack_loadbalancer_rule.foo.ipaddress}"
rule {
source_cidr = "0.0.0.0/0"
protocol = "tcp"
ports = ["${cloudstack_loadbalancer_rule.foo.public_port}"]
}
}
`, `,
CLOUDSTACK_SERVICE_OFFERING_1, CLOUDSTACK_SERVICE_OFFERING_1,
CLOUDSTACK_NETWORK_1, CLOUDSTACK_NETWORK_1,
@ -289,24 +277,12 @@ resource "cloudstack_instance" "foobar1" {
resource "cloudstack_loadbalancer_rule" "foo" { resource "cloudstack_loadbalancer_rule" "foo" {
name = "terraform-lb-update" name = "terraform-lb-update"
ipaddress = "%s" ip_address = "%s"
# network omitted, inferred from IP
algorithm = "leastconn" algorithm = "leastconn"
public_port = 80 public_port = 80
private_port = 80 private_port = 80
members = ["${cloudstack_instance.foobar1.id}"] members = ["${cloudstack_instance.foobar1.id}"]
} }
# attempt to create dependent firewall rule
# this will clash if cloudstack creates the implicit rule as it does by default
resource "cloudstack_firewall" "foo" {
ipaddress = "${cloudstack_loadbalancer_rule.foo.ipaddress}"
rule {
source_cidr = "0.0.0.0/0"
protocol = "tcp"
ports = ["${cloudstack_loadbalancer_rule.foo.public_port}"]
}
}
`, `,
CLOUDSTACK_SERVICE_OFFERING_1, CLOUDSTACK_SERVICE_OFFERING_1,
CLOUDSTACK_NETWORK_1, CLOUDSTACK_NETWORK_1,
@ -327,24 +303,12 @@ resource "cloudstack_instance" "foobar1" {
resource "cloudstack_loadbalancer_rule" "foo" { resource "cloudstack_loadbalancer_rule" "foo" {
name = "terraform-lb-update" name = "terraform-lb-update"
ipaddress = "%s" ip_address = "%s"
# network omitted, inferred from IP
algorithm = "leastconn" algorithm = "leastconn"
public_port = 443 public_port = 443
private_port = 443 private_port = 443
members = ["${cloudstack_instance.foobar1.id}"] members = ["${cloudstack_instance.foobar1.id}"]
} }
# attempt to create dependent firewall rule
# this will clash if cloudstack creates the implicit rule as it does by default
resource "cloudstack_firewall" "foo" {
ipaddress = "${cloudstack_loadbalancer_rule.foo.ipaddress}"
rule {
source_cidr = "0.0.0.0/0"
protocol = "tcp"
ports = ["${cloudstack_loadbalancer_rule.foo.public_port}"]
}
}
`, `,
CLOUDSTACK_SERVICE_OFFERING_1, CLOUDSTACK_SERVICE_OFFERING_1,
CLOUDSTACK_NETWORK_1, CLOUDSTACK_NETWORK_1,
@ -379,13 +343,12 @@ resource "cloudstack_instance" "foobar1" {
network = "${cloudstack_network.foo.name}" network = "${cloudstack_network.foo.name}"
template = "%s" template = "%s"
zone = "${cloudstack_network.foo.zone}" zone = "${cloudstack_network.foo.zone}"
user_data = "foobar\nfoo\nbar"
expunge = true expunge = true
} }
resource "cloudstack_loadbalancer_rule" "foo" { resource "cloudstack_loadbalancer_rule" "foo" {
name = "terraform-lb" name = "terraform-lb"
ipaddress = "${cloudstack_ipaddress.foo.ipaddress}" ip_address = "${cloudstack_ipaddress.foo.ip_address}"
algorithm = "roundrobin" algorithm = "roundrobin"
network = "${cloudstack_network.foo.id}" network = "${cloudstack_network.foo.id}"
public_port = 80 public_port = 80
@ -427,7 +390,6 @@ resource "cloudstack_instance" "foobar1" {
network = "${cloudstack_network.foo.name}" network = "${cloudstack_network.foo.name}"
template = "%s" template = "%s"
zone = "${cloudstack_network.foo.zone}" zone = "${cloudstack_network.foo.zone}"
user_data = "foobar\nfoo\nbar"
expunge = true expunge = true
} }
@ -438,18 +400,17 @@ resource "cloudstack_instance" "foobar2" {
network = "${cloudstack_network.foo.name}" network = "${cloudstack_network.foo.name}"
template = "%s" template = "%s"
zone = "${cloudstack_network.foo.zone}" zone = "${cloudstack_network.foo.zone}"
user_data = "foobar\nfoo\nbar"
expunge = true expunge = true
} }
resource "cloudstack_loadbalancer_rule" "foo" { resource "cloudstack_loadbalancer_rule" "foo" {
name = "terraform-lb-update" name = "terraform-lb-update"
ipaddress = "${cloudstack_ipaddress.foo.ipaddress}" ip_address = "${cloudstack_ipaddress.foo.ip_address}"
algorithm = "leastconn" algorithm = "leastconn"
network = "${cloudstack_network.foo.id}" network = "${cloudstack_network.foo.id}"
public_port = 443 public_port = 443
private_port = 443 private_port = 443
members = ["${cloudstack_instance.foobar2.id}", "${cloudstack_instance.foobar1.id}"] members = ["${cloudstack_instance.foobar1.id}", "${cloudstack_instance.foobar2.id}"]
}`, }`,
CLOUDSTACK_VPC_CIDR_1, CLOUDSTACK_VPC_CIDR_1,
CLOUDSTACK_VPC_OFFERING, CLOUDSTACK_VPC_OFFERING,

View File

@ -22,11 +22,19 @@ func resourceCloudStackNIC() *schema.Resource {
ForceNew: true, ForceNew: true,
}, },
"ip_address": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"ipaddress": &schema.Schema{ "ipaddress": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Optional: true,
Computed: true, Computed: true,
ForceNew: true, ForceNew: true,
Deprecated: "Please use the `ip_address` field instead",
}, },
"virtual_machine": &schema.Schema{ "virtual_machine": &schema.Schema{
@ -57,7 +65,11 @@ func resourceCloudStackNICCreate(d *schema.ResourceData, meta interface{}) error
p := cs.VirtualMachine.NewAddNicToVirtualMachineParams(networkid, virtualmachineid) p := cs.VirtualMachine.NewAddNicToVirtualMachineParams(networkid, virtualmachineid)
// If there is a ipaddres supplied, add it to the parameter struct // If there is a ipaddres supplied, add it to the parameter struct
if ipaddress, ok := d.GetOk("ipaddress"); ok { ipaddress, ok := d.GetOk("ip_address")
if !ok {
ipaddress, ok = d.GetOk("ipaddress")
}
if ok {
p.SetIpaddress(ipaddress.(string)) p.SetIpaddress(ipaddress.(string))
} }
@ -93,16 +105,16 @@ func resourceCloudStackNICRead(d *schema.ResourceData, meta interface{}) error {
log.Printf("[DEBUG] Instance %s does no longer exist", d.Get("virtual_machine").(string)) log.Printf("[DEBUG] Instance %s does no longer exist", d.Get("virtual_machine").(string))
d.SetId("") d.SetId("")
return nil return nil
} else {
return err
} }
return err
} }
// Read NIC info // Read NIC info
found := false found := false
for _, n := range vm.Nic { for _, n := range vm.Nic {
if n.Id == d.Id() { if n.Id == d.Id() {
d.Set("ipaddress", n.Ipaddress) d.Set("ip_address", n.Ipaddress)
setValueOrID(d, "network", n.Networkname, n.Networkid) setValueOrID(d, "network", n.Networkname, n.Networkid)
setValueOrID(d, "virtual_machine", vm.Name, vm.Id) setValueOrID(d, "virtual_machine", vm.Name, vm.Id)
found = true found = true

View File

@ -53,7 +53,7 @@ func TestAccCloudStackNIC_update(t *testing.T) {
"cloudstack_instance.foobar", "cloudstack_nic.foo", &nic), "cloudstack_instance.foobar", "cloudstack_nic.foo", &nic),
testAccCheckCloudStackNICIPAddress(&nic), testAccCheckCloudStackNICIPAddress(&nic),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_nic.foo", "ipaddress", CLOUDSTACK_2ND_NIC_IPADDRESS), "cloudstack_nic.foo", "ip_address", CLOUDSTACK_2ND_NIC_IPADDRESS),
), ),
}, },
}, },
@ -183,7 +183,7 @@ resource "cloudstack_instance" "foobar" {
resource "cloudstack_nic" "foo" { resource "cloudstack_nic" "foo" {
network = "%s" network = "%s"
ipaddress = "%s" ip_address = "%s"
virtual_machine = "${cloudstack_instance.foobar.name}" virtual_machine = "${cloudstack_instance.foobar.name}"
}`, }`,
CLOUDSTACK_SERVICE_OFFERING_1, CLOUDSTACK_SERVICE_OFFERING_1,

View File

@ -1,6 +1,7 @@
package cloudstack package cloudstack
import ( import (
"errors"
"fmt" "fmt"
"sync" "sync"
"time" "time"
@ -21,10 +22,19 @@ func resourceCloudStackPortForward() *schema.Resource {
Delete: resourceCloudStackPortForwardDelete, Delete: resourceCloudStackPortForwardDelete,
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"ip_address": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ConflictsWith: []string{"ipaddress"},
},
"ipaddress": &schema.Schema{ "ipaddress": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Required: true, Optional: true,
ForceNew: true, ForceNew: true,
Deprecated: "Please use the `ip_address` field instead",
ConflictsWith: []string{"ip_address"},
}, },
"managed": &schema.Schema{ "managed": &schema.Schema{
@ -72,8 +82,16 @@ func resourceCloudStackPortForward() *schema.Resource {
func resourceCloudStackPortForwardCreate(d *schema.ResourceData, meta interface{}) error { func resourceCloudStackPortForwardCreate(d *schema.ResourceData, meta interface{}) error {
cs := meta.(*cloudstack.CloudStackClient) cs := meta.(*cloudstack.CloudStackClient)
ipaddress, ok := d.GetOk("ip_address")
if !ok {
ipaddress, ok = d.GetOk("ipaddress")
}
if !ok {
return errors.New("Either `ip_address` or [deprecated] `ipaddress` must be provided.")
}
// Retrieve the ipaddress ID // Retrieve the ipaddress ID
ipaddressid, e := retrieveID(cs, "ipaddress", d.Get("ipaddress").(string)) ipaddressid, e := retrieveID(cs, "ip_address", ipaddress.(string))
if e != nil { if e != nil {
return e.Error() return e.Error()
} }

View File

@ -21,7 +21,7 @@ func TestAccCloudStackPortForward_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
testAccCheckCloudStackPortForwardsExist("cloudstack_port_forward.foo"), testAccCheckCloudStackPortForwardsExist("cloudstack_port_forward.foo"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_port_forward.foo", "ipaddress", CLOUDSTACK_PUBLIC_IPADDRESS), "cloudstack_port_forward.foo", "ip_address", CLOUDSTACK_PUBLIC_IPADDRESS),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_port_forward.foo", "forward.952396423.protocol", "tcp"), "cloudstack_port_forward.foo", "forward.952396423.protocol", "tcp"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
@ -47,7 +47,7 @@ func TestAccCloudStackPortForward_update(t *testing.T) {
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
testAccCheckCloudStackPortForwardsExist("cloudstack_port_forward.foo"), testAccCheckCloudStackPortForwardsExist("cloudstack_port_forward.foo"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_port_forward.foo", "ipaddress", CLOUDSTACK_PUBLIC_IPADDRESS), "cloudstack_port_forward.foo", "ip_address", CLOUDSTACK_PUBLIC_IPADDRESS),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_port_forward.foo", "forward.#", "1"), "cloudstack_port_forward.foo", "forward.#", "1"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
@ -66,7 +66,7 @@ func TestAccCloudStackPortForward_update(t *testing.T) {
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
testAccCheckCloudStackPortForwardsExist("cloudstack_port_forward.foo"), testAccCheckCloudStackPortForwardsExist("cloudstack_port_forward.foo"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_port_forward.foo", "ipaddress", CLOUDSTACK_PUBLIC_IPADDRESS), "cloudstack_port_forward.foo", "ip_address", CLOUDSTACK_PUBLIC_IPADDRESS),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_port_forward.foo", "forward.#", "2"), "cloudstack_port_forward.foo", "forward.#", "2"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
@ -161,7 +161,7 @@ resource "cloudstack_instance" "foobar" {
} }
resource "cloudstack_port_forward" "foo" { resource "cloudstack_port_forward" "foo" {
ipaddress = "%s" ip_address = "%s"
forward { forward {
protocol = "tcp" protocol = "tcp"
@ -187,7 +187,7 @@ resource "cloudstack_instance" "foobar" {
} }
resource "cloudstack_port_forward" "foo" { resource "cloudstack_port_forward" "foo" {
ipaddress = "%s" ip_address = "%s"
forward { forward {
protocol = "tcp" protocol = "tcp"

View File

@ -16,11 +16,19 @@ func resourceCloudStackSecondaryIPAddress() *schema.Resource {
Delete: resourceCloudStackSecondaryIPAddressDelete, Delete: resourceCloudStackSecondaryIPAddressDelete,
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"ip_address": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"ipaddress": &schema.Schema{ "ipaddress": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Optional: true,
Computed: true, Computed: true,
ForceNew: true, ForceNew: true,
Deprecated: "Please use the `ip_address` field instead",
}, },
"nicid": &schema.Schema{ "nicid": &schema.Schema{
@ -67,8 +75,13 @@ func resourceCloudStackSecondaryIPAddressCreate(d *schema.ResourceData, meta int
// Create a new parameter struct // Create a new parameter struct
p := cs.Nic.NewAddIpToNicParams(nicid) p := cs.Nic.NewAddIpToNicParams(nicid)
if addr := d.Get("ipaddress").(string); addr != "" { // If there is a ipaddres supplied, add it to the parameter struct
p.SetIpaddress(addr) ipaddress, ok := d.GetOk("ip_address")
if !ok {
ipaddress, ok = d.GetOk("ipaddress")
}
if ok {
p.SetIpaddress(ipaddress.(string))
} }
ip, err := cs.Nic.AddIpToNic(p) ip, err := cs.Nic.AddIpToNic(p)
@ -126,13 +139,13 @@ func resourceCloudStackSecondaryIPAddressRead(d *schema.ResourceData, meta inter
for _, ip := range l.Nics[0].Secondaryip { for _, ip := range l.Nics[0].Secondaryip {
if ip.Id == d.Id() { if ip.Id == d.Id() {
d.Set("ipaddress", ip.Ipaddress) d.Set("ip_address", ip.Ipaddress)
d.Set("nicid", l.Nics[0].Id) d.Set("nicid", l.Nics[0].Id)
return nil return nil
} }
} }
log.Printf("[DEBUG] IP %s no longer exist", d.Get("ipaddress").(string)) log.Printf("[DEBUG] IP %s no longer exist", d.Get("ip_address").(string))
d.SetId("") d.SetId("")
return nil return nil
@ -144,7 +157,7 @@ func resourceCloudStackSecondaryIPAddressDelete(d *schema.ResourceData, meta int
// Create a new parameter struct // Create a new parameter struct
p := cs.Nic.NewRemoveIpFromNicParams(d.Id()) p := cs.Nic.NewRemoveIpFromNicParams(d.Id())
log.Printf("[INFO] Removing secondary IP address: %s", d.Get("ipaddress").(string)) log.Printf("[INFO] Removing secondary IP address: %s", d.Get("ip_address").(string))
if _, err := cs.Nic.RemoveIpFromNic(p); err != nil { if _, err := cs.Nic.RemoveIpFromNic(p); err != nil {
// This is a very poor way to be told the ID does no longer exist :( // This is a very poor way to be told the ID does no longer exist :(
if strings.Contains(err.Error(), fmt.Sprintf( if strings.Contains(err.Error(), fmt.Sprintf(

View File

@ -43,7 +43,7 @@ func TestAccCloudStackSecondaryIPAddress_fixedIP(t *testing.T) {
"cloudstack_secondary_ipaddress.foo", &ip), "cloudstack_secondary_ipaddress.foo", &ip),
testAccCheckCloudStackSecondaryIPAddressAttributes(&ip), testAccCheckCloudStackSecondaryIPAddressAttributes(&ip),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"cloudstack_secondary_ipaddress.foo", "ipaddress", CLOUDSTACK_NETWORK_1_IPADDRESS1), "cloudstack_secondary_ipaddress.foo", "ip_address", CLOUDSTACK_NETWORK_1_IPADDRESS1),
), ),
}, },
}, },
@ -147,7 +147,7 @@ func testAccCheckCloudStackSecondaryIPAddressDestroy(s *terraform.State) error {
vm, count, err := cs.VirtualMachine.GetVirtualMachineByID(virtualmachineid) vm, count, err := cs.VirtualMachine.GetVirtualMachineByID(virtualmachineid)
if err != nil { if err != nil {
if count == 0 { if count == 0 {
return fmt.Errorf("Instance not found") return nil
} }
return err return err
} }
@ -215,7 +215,7 @@ resource "cloudstack_instance" "foobar" {
} }
resource "cloudstack_secondary_ipaddress" "foo" { resource "cloudstack_secondary_ipaddress" "foo" {
ipaddress = "%s" ip_address = "%s"
virtual_machine = "${cloudstack_instance.foobar.id}" virtual_machine = "${cloudstack_instance.foobar.id}"
}`, }`,
CLOUDSTACK_SERVICE_OFFERING_1, CLOUDSTACK_SERVICE_OFFERING_1,

View File

@ -69,7 +69,7 @@ func retrieveID(cs *cloudstack.CloudStackClient, name, value string) (id string,
id, err = cs.Network.GetNetworkID(value) id, err = cs.Network.GetNetworkID(value)
case "zone": case "zone":
id, err = cs.Zone.GetZoneID(value) id, err = cs.Zone.GetZoneID(value)
case "ipaddress": case "ip_address":
p := cs.Address.NewListPublicIpAddressesParams() p := cs.Address.NewListPublicIpAddressesParams()
p.SetIpaddress(value) p.SetIpaddress(value)
l, e := cs.Address.ListPublicIpAddresses(p) l, e := cs.Address.ListPublicIpAddresses(p)

View File

@ -14,7 +14,7 @@ Creates firewall rules for a given IP address.
``` ```
resource "cloudstack_firewall" "default" { resource "cloudstack_firewall" "default" {
ipaddress = "192.168.0.1" ip_address = "192.168.0.1"
rule { rule {
cidr_list = ["10.0.0.0/8"] cidr_list = ["10.0.0.0/8"]
@ -28,9 +28,12 @@ resource "cloudstack_firewall" "default" {
The following arguments are supported: The following arguments are supported:
* `ipaddress` - (Required) The IP address or ID for which to create the firewall * `ip_address` - (Required) The IP address or ID for which to create the firewall
rules. Changing this forces a new resource to be created. rules. Changing this forces a new resource to be created.
* `ipaddress` - (Required, Deprecated) The IP address or ID for which to create
the firewall rules. Changing this forces a new resource to be created.
* `managed` - (Optional) USE WITH CAUTION! If enabled all the firewall rules for * `managed` - (Optional) USE WITH CAUTION! If enabled all the firewall rules for
this IP address will be managed by this resource. This means it will delete this IP address will be managed by this resource. This means it will delete
all firewall rules that are not in your config! (defaults false) all firewall rules that are not in your config! (defaults false)

View File

@ -37,9 +37,12 @@ The following arguments are supported:
* `network` - (Optional) The name or ID of the network to connect this instance * `network` - (Optional) The name or ID of the network to connect this instance
to. Changing this forces a new resource to be created. to. Changing this forces a new resource to be created.
* `ipaddress` - (Optional) The IP address to assign to this instance. Changing * `ip_address` - (Optional) The IP address to assign to this instance. Changing
this forces a new resource to be created. this forces a new resource to be created.
* `ipaddress` - (Optional, Deprecated) The IP address to assign to this instance.
Changing this forces a new resource to be created.
* `template` - (Required) The name or ID of the template used for this * `template` - (Required) The name or ID of the template used for this
instance. Changing this forces a new resource to be created. instance. Changing this forces a new resource to be created.

View File

@ -38,4 +38,4 @@ The following arguments are supported:
The following attributes are exported: The following attributes are exported:
* `id` - The ID of the acquired and associated IP address. * `id` - The ID of the acquired and associated IP address.
* `ipaddress` - The IP address that was acquired and associated. * `ip_address` - The IP address that was acquired and associated.

View File

@ -16,7 +16,7 @@ Creates a loadbalancer rule.
resource "cloudstack_loadbalancer_rule" "default" { resource "cloudstack_loadbalancer_rule" "default" {
name = "loadbalancer-rule-1" name = "loadbalancer-rule-1"
description = "Loadbalancer rule 1" description = "Loadbalancer rule 1"
ipaddress = "192.168.0.1" ip_address = "192.168.0.1"
algorithm = "roundrobin" algorithm = "roundrobin"
private_port = 80 private_port = 80
public_port = 80 public_port = 80
@ -33,24 +33,32 @@ The following arguments are supported:
* `description` - (Optional) The description of the load balancer rule. * `description` - (Optional) The description of the load balancer rule.
* `ipaddress` - (Required) Public ip address from where the network traffic will be load balanced from. * `ip_address` - (Required) Public ip address from where the network traffic
Changing this forces a new resource to be created. will be load balanced from. Changing this forces a new resource to be
created.
* `network` - (Optional) The guest network this rule will be created for. Required when public Ip address is * `ipaddress` - (Required, Deprecated) Public ip address from where the
not associated with any Guest network yet (VPC case). network traffic will be load balanced from. Changing this forces a new
* `algorithm` - (Required) Load balancer rule algorithm (source, roundrobin, leastconn).Changing this forces
a new resource to be created.
* `private_port` - (Required) The private port of the private ip address/virtual machine where the network
traffic will be load balanced to. Changing this forces a new resource to be created.
* `public_port` - (Required) The public port from where the network traffic will be load balanced from.
Changing this forces a new resource to be created.
* `members` - (Required) List of instances to assign to the load balancer rule. Changing this forces a new
resource to be created. resource to be created.
* `network` - (Optional) The guest network this rule will be created for.
Required when public IP address is not associated with any Guest network
yet (VPC case).
* `algorithm` - (Required) Load balancer rule algorithm (source, roundrobin,
leastconn). Changing this forces a new resource to be created.
* `private_port` - (Required) The private port of the private IP address
(virtual machine) where the network traffic will be load balanced to.
Changing this forces a new resource to be created.
* `public_port` - (Required) The public port from where the network traffic
will be load balanced from. Changing this forces a new resource to be
created.
* `members` - (Required) List of instances to assign to the load balancer rule.
Changing this forces a new resource to be created.
## Attributes Reference ## Attributes Reference
The following attributes are exported: The following attributes are exported:

View File

@ -17,7 +17,7 @@ Basic usage:
``` ```
resource "cloudstack_nic" "test" { resource "cloudstack_nic" "test" {
network = "network-2" network = "network-2"
ipaddress = "192.168.1.1" ip_address = "192.168.1.1"
virtual_machine = "server-1" virtual_machine = "server-1"
} }
``` ```
@ -29,9 +29,12 @@ The following arguments are supported:
* `network` - (Required) The name or ID of the network to plug the NIC into. Changing * `network` - (Required) The name or ID of the network to plug the NIC into. Changing
this forces a new resource to be created. this forces a new resource to be created.
* `ipaddress` - (Optional) The IP address to assign to the NIC. Changing this * `ip_address` - (Optional) The IP address to assign to the NIC. Changing this
forces a new resource to be created. forces a new resource to be created.
* `ipaddress` - (Optional, Deprecated) The IP address to assign to the NIC. Changing
this forces a new resource to be created.
* `virtual_machine` - (Required) The name or ID of the virtual machine to which * `virtual_machine` - (Required) The name or ID of the virtual machine to which
to attach the NIC. Changing this forces a new resource to be created. to attach the NIC. Changing this forces a new resource to be created.
@ -40,4 +43,4 @@ The following arguments are supported:
The following attributes are exported: The following attributes are exported:
* `id` - The ID of the NIC. * `id` - The ID of the NIC.
* `ipaddress` - The assigned IP address. * `ip_address` - The assigned IP address.

View File

@ -14,7 +14,7 @@ Creates port forwards.
``` ```
resource "cloudstack_port_forward" "default" { resource "cloudstack_port_forward" "default" {
ipaddress = "192.168.0.1" ip_address = "192.168.0.1"
forward { forward {
protocol = "tcp" protocol = "tcp"
@ -29,9 +29,12 @@ resource "cloudstack_port_forward" "default" {
The following arguments are supported: The following arguments are supported:
* `ipaddress` - (Required) The IP address for which to create the port forwards. * `ip_address` - (Required) The IP address for which to create the port forwards.
Changing this forces a new resource to be created. Changing this forces a new resource to be created.
* `ipaddress` - (Required, Deprecated) The IP address for which to create the port
forwards. Changing this forces a new resource to be created.
* `managed` - (Optional) USE WITH CAUTION! If enabled all the port forwards for * `managed` - (Optional) USE WITH CAUTION! If enabled all the port forwards for
this IP address will be managed by this resource. This means it will delete this IP address will be managed by this resource. This means it will delete
all port forwards that are not in your config! (defaults false) all port forwards that are not in your config! (defaults false)
@ -54,4 +57,4 @@ The `forward` block supports:
The following attributes are exported: The following attributes are exported:
* `ipaddress` - The IP address for which the port forwards are created. * `ip_address` - The IP address for which the port forwards are created.

View File

@ -22,10 +22,14 @@ resource "cloudstack_secondary_ipaddress" "default" {
The following arguments are supported: The following arguments are supported:
* `ipaddress` - (Optional) The IP address to attach the to NIC. If not supplied * `ip_address` - (Optional) The IP address to attach the to NIC. If not supplied
an IP address will be selected randomly. Changing this forces a new resource an IP address will be selected randomly. Changing this forces a new resource
to be created. to be created.
* `ipaddress` - (Optional, Deprecated) The IP address to attach the to NIC. If
not supplied an IP address will be selected randomly. Changing this forces
a new resource to be created.
* `nicid` - (Optional) The ID of the NIC to which you want to attach the * `nicid` - (Optional) The ID of the NIC to which you want to attach the
secondary IP address. Changing this forces a new resource to be secondary IP address. Changing this forces a new resource to be
created (defaults to the ID of the primary NIC) created (defaults to the ID of the primary NIC)

View File

@ -65,6 +65,10 @@
<a href="/docs/providers/cloudstack/r/ssh_keypair.html">cloudstack_ssh_keypair</a> <a href="/docs/providers/cloudstack/r/ssh_keypair.html">cloudstack_ssh_keypair</a>
</li> </li>
<li<%= sidebar_current("docs-cloudstack-resource-static-nat") %>>
<a href="/docs/providers/cloudstack/r/static_nat.html">cloudstack_static_nat</a>
</li>
<li<%= sidebar_current("docs-cloudstack-resource-template") %>> <li<%= sidebar_current("docs-cloudstack-resource-template") %>>
<a href="/docs/providers/cloudstack/r/template.html">cloudstack_template</a> <a href="/docs/providers/cloudstack/r/template.html">cloudstack_template</a>
</li> </li>