Skip to content

Commit 6cd373e

Browse files
authored
Added crn to virtual network interface for is_instance (IBM-Cloud#6297)
* Added crn to virtual network interface for is_instance * Added crn for bare metal server VNIs * Added the documentation for vni crn
1 parent 01c2d86 commit 6cd373e

7 files changed

+40
-0
lines changed

ibm/service/vpc/resource_ibm_is_bare_metal_server.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,11 @@ func ResourceIBMIsBareMetalServer() *schema.Resource {
510510
Computed: true,
511511
Description: "The virtual network interface id for this bare metal server network attachment.",
512512
},
513+
"crn": &schema.Schema{
514+
Type: schema.TypeString,
515+
Computed: true,
516+
Description: "The crn of the virtual network interface.",
517+
},
513518
"allow_ip_spoofing": &schema.Schema{
514519
Type: schema.TypeBool,
515520
Optional: true,
@@ -912,6 +917,11 @@ func ResourceIBMIsBareMetalServer() *schema.Resource {
912917
Computed: true,
913918
Description: "The virtual network interface id for this bare metal server network attachment.",
914919
},
920+
"crn": &schema.Schema{
921+
Type: schema.TypeString,
922+
Computed: true,
923+
Description: "The crn of the virtual network interface.",
924+
},
915925
"allow_ip_spoofing": &schema.Schema{
916926
Type: schema.TypeBool,
917927
Optional: true,
@@ -4718,6 +4728,7 @@ func resourceIBMIsBareMetalServerBareMetalServerNetworkAttachmentReferenceToMap(
47184728
vniid = *vna.VirtualNetworkInterface.ID
47194729
vniMap["id"] = vniid
47204730
vniMap["name"] = vna.VirtualNetworkInterface.Name
4731+
vniMap["crn"] = vna.VirtualNetworkInterface.CRN
47214732
vniMap["resource_type"] = vna.VirtualNetworkInterface.ResourceType
47224733
}
47234734
}
@@ -4734,6 +4745,7 @@ func resourceIBMIsBareMetalServerBareMetalServerNetworkAttachmentReferenceToMap(
47344745
vniid = *vna.VirtualNetworkInterface.ID
47354746
vniMap["id"] = vniid
47364747
vniMap["name"] = vna.VirtualNetworkInterface.Name
4748+
vniMap["crn"] = vna.VirtualNetworkInterface.CRN
47374749
vniMap["resource_type"] = vna.VirtualNetworkInterface.ResourceType
47384750
}
47394751
}
@@ -4744,6 +4756,7 @@ func resourceIBMIsBareMetalServerBareMetalServerNetworkAttachmentReferenceToMap(
47444756
vniid = *vna.VirtualNetworkInterface.ID
47454757
vniMap["id"] = vniid
47464758
vniMap["name"] = vna.VirtualNetworkInterface.Name
4759+
vniMap["crn"] = vna.VirtualNetworkInterface.CRN
47474760
vniMap["resource_type"] = vna.VirtualNetworkInterface.ResourceType
47484761
}
47494762
if vna.AllowedVlans != nil {

ibm/service/vpc/resource_ibm_is_bare_metal_server_network_attachment.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ func ResourceIBMIsBareMetalServerNetworkAttachment() *schema.Resource {
8484
ForceNew: true,
8585
Description: "The virtual network interface id for this bare metal server network attachment.",
8686
},
87+
"crn": &schema.Schema{
88+
Type: schema.TypeString,
89+
Computed: true,
90+
Description: "The crn of the virtual network interface.",
91+
},
8792
"allow_ip_spoofing": &schema.Schema{
8893
Type: schema.TypeBool,
8994
Optional: true,
@@ -1349,6 +1354,7 @@ func resourceIBMIsBareMetalServerNetworkAttachmentVirtualNetworkInterfaceReferen
13491354
modelMap["subnet"] = *vniDetails.Subnet.ID
13501355
}
13511356
modelMap["id"] = model.ID
1357+
modelMap["crn"] = model.CRN
13521358
modelMap["name"] = model.Name
13531359
modelMap["resource_type"] = model.ResourceType
13541360
return modelMap, nil

ibm/service/vpc/resource_ibm_is_instance.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,11 @@ func ResourceIBMISInstance() *schema.Resource {
11311131
Computed: true,
11321132
Description: "The resource type.",
11331133
},
1134+
"crn": &schema.Schema{
1135+
Type: schema.TypeString,
1136+
Computed: true,
1137+
Description: "The crn of the virtual network interface.",
1138+
},
11341139
"security_groups": {
11351140
Type: schema.TypeSet,
11361141
Optional: true,
@@ -1518,6 +1523,11 @@ func ResourceIBMISInstance() *schema.Resource {
15181523
Computed: true,
15191524
Description: "The resource type.",
15201525
},
1526+
"crn": &schema.Schema{
1527+
Type: schema.TypeString,
1528+
Computed: true,
1529+
Description: "The crn of the virtual network interface.",
1530+
},
15211531
"security_groups": {
15221532
Type: schema.TypeSet,
15231533
Optional: true,
@@ -8104,6 +8114,7 @@ func resourceIBMIsInstanceInstanceNetworkAttachmentReferenceToMap(model *vpcv1.I
81048114
vniMap := make(map[string]interface{})
81058115
if pna.VirtualNetworkInterface != nil {
81068116
vniMap["id"] = *pna.VirtualNetworkInterface.ID
8117+
vniMap["crn"] = *pna.VirtualNetworkInterface.CRN
81078118
vniMap["name"] = pna.VirtualNetworkInterface.Name
81088119
vniMap["resource_type"] = pna.VirtualNetworkInterface.ResourceType
81098120
}

ibm/service/vpc/resource_ibm_is_instance_network_attachment.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ func ResourceIBMIsInstanceNetworkAttachment() *schema.Resource {
9595
ConflictsWith: []string{"virtual_network_interface.0.allow_ip_spoofing", "virtual_network_interface.0.auto_delete", "virtual_network_interface.0.enable_infrastructure_nat", "virtual_network_interface.0.ips", "virtual_network_interface.0.name", "virtual_network_interface.0.primary_ip", "virtual_network_interface.0.resource_group", "virtual_network_interface.0.security_groups", "virtual_network_interface.0.security_groups"},
9696
Description: "The virtual network interface id for this instance network attachment.",
9797
},
98+
"crn": &schema.Schema{
99+
Type: schema.TypeString,
100+
Computed: true,
101+
Description: "The crn of the virtual network interface.",
102+
},
98103
"allow_ip_spoofing": &schema.Schema{
99104
Type: schema.TypeBool,
100105
Optional: true,
@@ -429,6 +434,7 @@ func resourceIBMIsInstanceNetworkAttachmentRead(context context.Context, d *sche
429434
return tfErr.GetDiag()
430435
}
431436
vniMap["allow_ip_spoofing"] = vniDetails.AllowIPSpoofing
437+
vniMap["crn"] = vniDetails.CRN
432438
vniMap["auto_delete"] = vniDetails.AutoDelete
433439
vniMap["enable_infrastructure_nat"] = vniDetails.EnableInfrastructureNat
434440
vniMap["name"] = vniDetails.Name

website/docs/r/is_bare_metal_server.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ Review the argument references that you can specify for your resource.
223223
Nested schema for **virtual_network_interface**:
224224
- `allow_ip_spoofing` - (Optional, Boolean) Indicates whether source IP spoofing is allowed on this interface. If `false`, source IP spoofing is prevented on this interface. If `true`, source IP spoofing is allowed on this interface.
225225
- `auto_delete` - (Optional, Boolean) Indicates whether this virtual network interface will be automatically deleted when`target` is deleted.
226+
- `crn` - (String) The CRN for this virtual network interface.
226227
- `enable_infrastructure_nat` - (Optional, Boolean) If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`.
227228
- `ips` - (Optional, List) The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`.
228229
Nested schema for **ips**:
@@ -285,6 +286,7 @@ Review the argument references that you can specify for your resource.
285286
Nested schema for **virtual_network_interface**:
286287
- `allow_ip_spoofing` - (Optional, Boolean) Indicates whether source IP spoofing is allowed on this interface. If `false`, source IP spoofing is prevented on this interface. If `true`, source IP spoofing is allowed on this interface.
287288
- `auto_delete` - (Optional, Boolean) Indicates whether this virtual network interface will be automatically deleted when`target` is deleted.
289+
- `crn` - (String) The CRN for this virtual network interface.
288290
- `enable_infrastructure_nat` - (Optional, Boolean) If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP.If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`.
289291
- `ips` - (Optional, List) The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`.
290292
Nested schema for **ips**:

website/docs/r/is_bare_metal_server_network_attachment.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ You can specify the following arguments for this resource.
5151
Nested schema for **virtual_network_interface**:
5252
- `allow_ip_spoofing` - (Optional, Boolean) Indicates whether source IP spoofing is allowed on this interface. If `false`, source IP spoofing is prevented on this interface. If `true`, source IP spoofing is allowed on this interface.
5353
- `auto_delete` - (Optional, Boolean) Indicates whether this virtual network interface will be automatically deleted when`target` is deleted.
54+
- `crn` - (String) The CRN for this virtual network interface.
5455
- `enable_infrastructure_nat` - (Optional, Boolean) If `true`:- The VPC infrastructure performs any needed NAT operations.- `floating_ips` must not have more than one floating IP. If `false`:- Packets are passed unchanged to/from the network interface, allowing the workload to perform any needed NAT operations.- `allow_ip_spoofing` must be `false`.- If the virtual network interface is attached: - The target `resource_type` must be `bare_metal_server_network_attachment`. - The target `interface_type` must not be `hipersocket`.
5556
- `ips` - (Optional, List) The reserved IPs bound to this virtual network interface.May be empty when `lifecycle_state` is `pending`.
5657
Nested schema for **ips**:

website/docs/r/is_instance_network_attachment.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ You can specify the following arguments for this resource.
108108
- `virtual_network_interface` - (Required, List) The virtual network interface for this instance network attachment. This can be specified using an existing virtual network interface ID, or a prototype object for a new virtual network interface.
109109

110110
Nested schema for **virtual_network_interface**:
111+
- `crn` - (String) The CRN for this virtual network interface.
111112
- `id` - (Optional, String) The unique identifier for an existing virtual network interface. When specified, all other nested arguments are ignored and will conflict if provided.
112113
- `allow_ip_spoofing` - (Optional, Boolean) Indicates whether source IP spoofing is allowed on this interface. If `false`, source IP spoofing is prevented on this interface. If `true`, source IP spoofing is allowed on this interface. Conflicts with `id`.
113114
- `auto_delete` - (Optional, Boolean) Indicates whether this virtual network interface will be automatically deleted when `target` is deleted. Conflicts with `id`.

0 commit comments

Comments
 (0)