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 Mar 15, 2022
1 parent 517eca3 commit 2ba8c66
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 7 deletions.
1 change: 0 additions & 1 deletion ibm/service/vpc/data_source_ibm_is_floating_ip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,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/service/vpc/data_source_ibm_is_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,9 @@ func instanceGetByName(d *schema.ResourceData, meta interface{}, name string) er
if err != nil {
return fmt.Errorf("[ERROR] 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/service/vpc/data_source_ibm_is_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ func TestAccIBMISInstanceDataSource_basic(t *testing.T) {
resName, "name", instanceName),
resource.TestCheckResourceAttr(
resName, "tags.#", "1"),
resource.TestCheckResourceAttrSet(
resName, "primary_network_interface.0.port_speed"),
resource.TestCheckResourceAttrSet(
resName, "availability_policy.#"),
),
Expand Down Expand Up @@ -63,7 +65,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/service/vpc/resource_ibm_is_floating_ip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,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/service/vpc/resource_ibm_is_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -1799,6 +1799,9 @@ func instanceGet(d *schema.ResourceData, meta interface{}, id string) error {
return fmt.Errorf("[ERROR] 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/service/vpc/resource_ibm_is_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVE
"ibm_is_instance.testacc_instance", "user_data", userData2),
resource.TestCheckResourceAttr(
"ibm_is_instance.testacc_instance", "zone", acc.ISZoneName),
resource.TestCheckResourceAttrSet(
"ibm_is_instance.testacc_instance", "primary_network_interface.0.port_speed"),
),
},
},
Expand Down
1 change: 0 additions & 1 deletion ibm/service/vpc/resource_ibm_is_lb_pool_member_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,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" "example" {
profile = "bc1-2x8"
primary_network_interface {
port_speed = "1000"
subnet = ibm_is_subnet.example.id
}
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" "example" {
profile = "bc1-2x8"
primary_network_interface {
port_speed = "1000"
subnet = ibm_is_subnet.example.id
}
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 @@ -320,7 +320,6 @@ Review the argument references that you can specify for your resource.
`allow_ip_spoofing` requires **IP spoofing operator** access under VPC infrastructure Services. As the **IP spoofing operator**, you can enable or disable the IP spoofing check on virtual server instances. 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 2ba8c66

Please sign in to comment.