Skip to content

Commit

Permalink
fix(is_instance) : added logic to set port speed in primary nic of in…
Browse files Browse the repository at this point in the history
…stance datasource and resource
  • Loading branch information
uibm committed Jan 20, 2022
1 parent bb2c8d8 commit 6a84371
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 7 deletions.
1 change: 0 additions & 1 deletion ibm/data_source_ibm_is_floating_ip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ func testAccCheckIBMISFloatingIPDataSourceConfig(vpcname, subnetname, sshname, p
image = "%s"
profile = "%s"
primary_network_interface {
port_speed = "100"
subnet = ibm_is_subnet.testacc_subnet.id
}
vpc = ibm_is_vpc.testacc_vpc.id
Expand Down
3 changes: 3 additions & 0 deletions ibm/data_source_ibm_is_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,9 @@ func instanceGetByName(d *schema.ResourceData, meta interface{}, name string) er
if err != nil {
return fmt.Errorf("Error getting network interfaces attached to the instance %s\n%s", err, response)
}
if insnic.PortSpeed != nil {
currentPrimNic[isInstanceNicPortSpeed] = *insnic.PortSpeed
}
currentPrimNic[isInstanceNicSubnet] = *insnic.Subnet.ID
if len(insnic.SecurityGroups) != 0 {
secgrpList := []string{}
Expand Down
3 changes: 2 additions & 1 deletion ibm/data_source_ibm_is_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ func TestAccIBMISInstanceDataSource_basic(t *testing.T) {
resName, "name", instanceName),
resource.TestCheckResourceAttr(
resName, "tags.#", "1"),
resource.TestCheckResourceAttrSet(
resName, "primary_network_interface.0.port_speed"),
),
},
},
Expand Down Expand Up @@ -59,7 +61,6 @@ resource "ibm_is_instance" "testacc_instance" {
image = "%s"
profile = "%s"
primary_network_interface {
port_speed = "100"
subnet = ibm_is_subnet.testacc_subnet.id
}
vpc = ibm_is_vpc.testacc_vpc.id
Expand Down
1 change: 0 additions & 1 deletion ibm/resource_ibm_is_floating_ip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ func testAccCheckIBMISFloatingIPConfig(vpcname, subnetname, sshname, publicKey,
image = "%s"
profile = "%s"
primary_network_interface {
port_speed = "100"
subnet = ibm_is_subnet.testacc_subnet.id
}
user_data = "%s"
Expand Down
3 changes: 3 additions & 0 deletions ibm/resource_ibm_is_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -1601,6 +1601,9 @@ func instanceGet(d *schema.ResourceData, meta interface{}, id string) error {
return fmt.Errorf("Error getting network interfaces attached to the instance %s\n%s", err, response)
}
currentPrimNic[isInstanceNicAllowIPSpoofing] = *insnic.AllowIPSpoofing
if insnic.PortSpeed != nil {
currentPrimNic[isInstanceNicPortSpeed] = *insnic.PortSpeed
}
currentPrimNic[isInstanceNicSubnet] = *insnic.Subnet.ID
if len(insnic.SecurityGroups) != 0 {
secgrpList := []string{}
Expand Down
2 changes: 2 additions & 0 deletions ibm/resource_ibm_is_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVE
"ibm_is_instance.testacc_instance", "user_data", userData2),
resource.TestCheckResourceAttr(
"ibm_is_instance.testacc_instance", "zone", ISZoneName),
resource.TestCheckResourceAttrSet(
"ibm_is_instance.testacc_instance", "primary_network_interface.0.port_speed"),
),
},
},
Expand Down
1 change: 0 additions & 1 deletion ibm/resource_ibm_is_lb_pool_member_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ func testAccCheckIBMISLBPoolMemberIDConfig(vpcname, subnetname, zone, cidr, sshn
image = data.ibm_is_image.ds_image.id
profile = "%s"
primary_network_interface {
port_speed = "100"
subnet = ibm_is_subnet.testacc_subnet.id
}
vpc = ibm_is_vpc.testacc_vpc.id
Expand Down
1 change: 0 additions & 1 deletion website/docs/r/is_floating_ip.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ resource "ibm_is_instance" "testacc_instance" {
profile = "b-2x8"
primary_network_interface {
port_speed = "1000"
subnet = "70be8eae-134c-436e-a86e-04849f84cb34"
}
Expand Down
1 change: 0 additions & 1 deletion website/docs/r/is_flow_log.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ resource "ibm_is_instance" "testacc_instance" {
profile = "b-2x8"
primary_network_interface {
port_speed = "1000"
subnet = "70be8eae-134c-436e-a86e-04849f84cb34"
}
Expand Down
1 change: 0 additions & 1 deletion website/docs/r/is_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ Review the argument references that you can specify for your resource.
- Use this only if you have **IP spoofing operator** access.

- `name` - (Optional, String) The name of the network interface.
- `port_speed` - (Deprecated, Integer) Speed of the network interface.
- `primary_ipv4_address` - (Optional, Forces new resource, String) The IPV4 address of the interface.
- `subnet` - (Required, String) The ID of the subnet.
- `security_groups`-List of strings-Optional-A comma separated list of security groups to add to the primary network interface.
Expand Down

0 comments on commit 6a84371

Please sign in to comment.