diff --git a/go.mod b/go.mod index 9331c5dfe6..a784b178ad 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ toolchain go1.22.5 require ( github.com/IBM-Cloud/bluemix-go v0.0.0-20240719075425-078fcb3a55be github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240725064144-454a2ae23113 - github.com/IBM-Cloud/power-go-client v1.7.0 + github.com/IBM-Cloud/power-go-client v1.8.1 github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca github.com/IBM/appconfiguration-go-admin-sdk v0.3.0 github.com/IBM/appid-management-go-sdk v0.0.0-20210908164609-dd0e0eaf732f diff --git a/go.sum b/go.sum index 5db19a9fe9..6e1a9cdfea 100644 --- a/go.sum +++ b/go.sum @@ -118,8 +118,8 @@ github.com/IBM-Cloud/bluemix-go v0.0.0-20240719075425-078fcb3a55be/go.mod h1:/7h github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240725064144-454a2ae23113 h1:f2Erqfea1dKpaTFagTJM6W/wnD3JGq/Vn9URh8nuRwk= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240725064144-454a2ae23113/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY= github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.5.3/go.mod h1:RiUvKuHKTBmBApDMUQzBL14pQUGKcx/IioKQPIcRQjs= -github.com/IBM-Cloud/power-go-client v1.7.0 h1:/GuGwPMTKoCZACfnwt7b6wKr4v32q1VO1AMFGNETRN4= -github.com/IBM-Cloud/power-go-client v1.7.0/go.mod h1:9izycYAmNQ+NAdVPXDC3fHYxqWLjlR2YiwqKYveMv5Y= +github.com/IBM-Cloud/power-go-client v1.8.1 h1:tx1aPJmIQrNru1MD1VHGNasGx3eRIs0zzPZ0KvdFQrg= +github.com/IBM-Cloud/power-go-client v1.8.1/go.mod h1:N4RxrsMUvBQjSQ/qPk0iMZ8zK+fZPRTnHi/gTaASw0g= github.com/IBM-Cloud/softlayer-go v1.0.5-tf h1:koUAyF9b6X78lLLruGYPSOmrfY2YcGYKOj/Ug9nbKNw= github.com/IBM-Cloud/softlayer-go v1.0.5-tf/go.mod h1:6HepcfAXROz0Rf63krk5hPZyHT6qyx2MNvYyHof7ik4= github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca h1:crniVcf+YcmgF03NmmfonXwSQ73oJF+IohFYBwknMxs= diff --git a/ibm/service/power/data_source_ibm_pi_network.go b/ibm/service/power/data_source_ibm_pi_network.go index 2835514f90..dec8dab0cc 100644 --- a/ibm/service/power/data_source_ibm_pi_network.go +++ b/ibm/service/power/data_source_ibm_pi_network.go @@ -5,10 +5,12 @@ package power import ( "context" + "log" "github.com/IBM-Cloud/power-go-client/clients/instance" "github.com/IBM-Cloud/power-go-client/helpers" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" @@ -48,6 +50,11 @@ func DataSourceIBMPINetwork() *schema.Resource { Description: "The CIDR of the network.", Type: schema.TypeString, }, + Attr_CRN: { + Computed: true, + Description: "The CRN of this resource.", + Type: schema.TypeString, + }, Attr_DNS: { Computed: true, Description: "The DNS Servers for the network.", @@ -91,6 +98,13 @@ func DataSourceIBMPINetwork() *schema.Resource { Description: "The percentage of IP addresses used.", Type: schema.TypeFloat, }, + Attr_UserTags: { + Computed: true, + Description: "List of user tags attached to the resource.", + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + Type: schema.TypeSet, + }, Attr_VLanID: { Computed: true, Description: "The VLAN ID that the network is connected to.", @@ -122,6 +136,14 @@ func dataSourceIBMPINetworkRead(ctx context.Context, d *schema.ResourceData, met if networkdata.Cidr != nil { d.Set(Attr_CIDR, networkdata.Cidr) } + if networkdata.Crn != "" { + d.Set(Attr_CRN, networkdata.Crn) + tags, err := flex.GetGlobalTagsUsingCRN(meta, string(networkdata.Crn), "", UserTagType) + if err != nil { + log.Printf("Error on get of pi network (%s) user_tags: %s", *networkdata.NetworkID, err) + } + d.Set(Attr_UserTags, tags) + } if len(networkdata.DNSServers) > 0 { d.Set(Attr_DNS, networkdata.DNSServers) } diff --git a/ibm/service/power/data_source_ibm_pi_network_test.go b/ibm/service/power/data_source_ibm_pi_network_test.go index c4c09fa58c..9cb5fa3c72 100644 --- a/ibm/service/power/data_source_ibm_pi_network_test.go +++ b/ibm/service/power/data_source_ibm_pi_network_test.go @@ -13,6 +13,7 @@ import ( ) func TestAccIBMPINetworkDataSource_basic(t *testing.T) { + networkRes := "data.ibm_pi_network.testacc_ds_network" resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, @@ -20,7 +21,7 @@ func TestAccIBMPINetworkDataSource_basic(t *testing.T) { { Config: testAccCheckIBMPINetworkDataSourceConfig(), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_pi_network.testacc_ds_network", "id"), + resource.TestCheckResourceAttrSet(networkRes, "id"), ), }, }, diff --git a/ibm/service/power/data_source_ibm_pi_networks.go b/ibm/service/power/data_source_ibm_pi_networks.go index 75d9fc6964..db5c3ed5c2 100644 --- a/ibm/service/power/data_source_ibm_pi_networks.go +++ b/ibm/service/power/data_source_ibm_pi_networks.go @@ -5,10 +5,12 @@ package power import ( "context" + "log" "github.com/IBM-Cloud/power-go-client/clients/instance" "github.com/IBM-Cloud/power-go-client/power/models" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" "github.com/hashicorp/go-uuid" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -38,6 +40,11 @@ func DataSourceIBMPINetworks() *schema.Resource { Description: "The network communication configuration option of the network (for satellite locations only).", Type: schema.TypeString, }, + Attr_CRN: { + Computed: true, + Description: "The CRN of this resource.", + Type: schema.TypeString, + }, Attr_DhcpManaged: { Computed: true, Description: "Indicates if the network DHCP Managed.", @@ -68,6 +75,13 @@ func DataSourceIBMPINetworks() *schema.Resource { Description: "The type of network.", Type: schema.TypeString, }, + Attr_UserTags: { + Computed: true, + Description: "List of user tags attached to the resource.", + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + Type: schema.TypeSet, + }, Attr_VLanID: { Computed: true, Description: "The VLAN ID that the network is connected to.", @@ -97,12 +111,12 @@ func dataSourceIBMPINetworksRead(ctx context.Context, d *schema.ResourceData, me var clientgenU, _ = uuid.GenerateUUID() d.SetId(clientgenU) - d.Set(Attr_Networks, flattenNetworks(networkdata.Networks)) + d.Set(Attr_Networks, flattenNetworks(networkdata.Networks, meta)) return nil } -func flattenNetworks(list []*models.NetworkReference) []map[string]interface{} { +func flattenNetworks(list []*models.NetworkReference, meta interface{}) []map[string]interface{} { result := make([]map[string]interface{}, 0, len(list)) for _, i := range list { l := map[string]interface{}{ @@ -115,6 +129,15 @@ func flattenNetworks(list []*models.NetworkReference) []map[string]interface{} { Attr_Type: *i.Type, Attr_VLanID: *i.VlanID, } + + if i.Crn != "" { + l[Attr_CRN] = i.Crn + tags, err := flex.GetGlobalTagsUsingCRN(meta, string(i.Crn), "", UserTagType) + if err != nil { + log.Printf("Error on get of pi network (%s) user_tags: %s", *i.NetworkID, err) + } + l[Attr_UserTags] = tags + } result = append(result, l) } return result diff --git a/ibm/service/power/data_source_ibm_pi_networks_test.go b/ibm/service/power/data_source_ibm_pi_networks_test.go index 3235db2a64..2d53f2e73b 100644 --- a/ibm/service/power/data_source_ibm_pi_networks_test.go +++ b/ibm/service/power/data_source_ibm_pi_networks_test.go @@ -13,6 +13,7 @@ import ( ) func TestAccIBMPINetworksDataSource_basic(t *testing.T) { + networksResData := "data.ibm_pi_networks.testacc_ds_networks" resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, @@ -20,7 +21,7 @@ func TestAccIBMPINetworksDataSource_basic(t *testing.T) { { Config: testAccCheckIBMPINetworksDataSourceConfig(), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_pi_networks.testacc_ds_networks", "id"), + resource.TestCheckResourceAttrSet(networksResData, "id"), ), }, }, diff --git a/ibm/service/power/data_source_ibm_pi_public_network.go b/ibm/service/power/data_source_ibm_pi_public_network.go index ef8195c964..04af881a3c 100644 --- a/ibm/service/power/data_source_ibm_pi_public_network.go +++ b/ibm/service/power/data_source_ibm_pi_public_network.go @@ -26,6 +26,11 @@ func DataSourceIBMPIPublicNetwork() *schema.Resource { }, // Attributes + Attr_CRN: { + Computed: true, + Description: "The CRN of this resource.", + Type: schema.TypeString, + }, Attr_Name: { Computed: true, Description: "The name of the network.", @@ -63,6 +68,9 @@ func dataSourceIBMPIPublicNetworkRead(ctx context.Context, d *schema.ResourceDat } d.SetId(*networkdata.Networks[0].NetworkID) + if networkdata.Networks[0].Crn != "" { + d.Set(Attr_CRN, networkdata.Networks[0].Crn) + } if networkdata.Networks[0].Name != nil { d.Set(Attr_Name, networkdata.Networks[0].Name) } diff --git a/ibm/service/power/data_source_ibm_pi_public_network_test.go b/ibm/service/power/data_source_ibm_pi_public_network_test.go index 3ac39c13a6..3062b232de 100644 --- a/ibm/service/power/data_source_ibm_pi_public_network_test.go +++ b/ibm/service/power/data_source_ibm_pi_public_network_test.go @@ -13,6 +13,7 @@ import ( ) func TestAccIBMPIPublicNetworkDataSource_basic(t *testing.T) { + publicNetworkResData := "data.ibm_pi_public_network.testacc_ds_public_network" resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, @@ -20,7 +21,7 @@ func TestAccIBMPIPublicNetworkDataSource_basic(t *testing.T) { { Config: testAccCheckIBMPIPublicNetworkDataSourceConfig(), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_pi_public_network.testacc_ds_public_network", "id"), + resource.TestCheckResourceAttrSet(publicNetworkResData, "id"), ), }, }, diff --git a/ibm/service/power/ibm_pi_constants.go b/ibm/service/power/ibm_pi_constants.go index 6f3fff8509..52d828de19 100644 --- a/ibm/service/power/ibm_pi_constants.go +++ b/ibm/service/power/ibm_pi_constants.go @@ -85,6 +85,7 @@ const ( Arg_SysType = "pi_sys_type" Arg_TargetStorageTier = "pi_target_storage_tier" Arg_UserData = "pi_user_data" + Arg_UserTags = "pi_user_tags" Arg_VirtualCoresAssigned = "pi_virtual_cores_assigned" Arg_VirtualOpticalDevice = "pi_virtual_optical_device" Arg_VolumeCloneName = "pi_volume_clone_name" @@ -371,6 +372,7 @@ const ( Attr_UsedIPPercent = "used_ip_percent" Attr_UsedMemory = "used_memory" Attr_UserIPAddress = "user_ip_address" + Attr_UserTags = "user_tags" Attr_VCPUs = "vcpus" Attr_Vendor = "vendor" Attr_VirtualCoresAssigned = "virtual_cores_assigned" @@ -443,6 +445,7 @@ const ( Shared = "shared" Soft = "soft" Suffix = "suffix" + UserTagType = "user" Vlan = "vlan" vSCSI = "vSCSI" Warning = "WARNING" diff --git a/ibm/service/power/resource_ibm_pi_network.go b/ibm/service/power/resource_ibm_pi_network.go index 5842599a2b..3670aa3d10 100644 --- a/ibm/service/power/resource_ibm_pi_network.go +++ b/ibm/service/power/resource_ibm_pi_network.go @@ -122,8 +122,20 @@ func ResourceIBMPINetwork() *schema.Resource { }, }, }, + Arg_UserTags: { + Description: "The user tags attached to this resource.", + Elem: &schema.Schema{Type: schema.TypeString}, + Optional: true, + Set: schema.HashString, + Type: schema.TypeSet, + }, //Computed Attributes + Attr_CRN: { + Computed: true, + Description: "The CRN of this resource.", + Type: schema.TypeString, + }, "network_id": { Type: schema.TypeString, Computed: true, @@ -158,7 +170,9 @@ func resourceIBMPINetworkCreate(ctx context.Context, d *schema.ResourceData, met body.DNSServers = networkdns } } - + if tags, ok := d.GetOk(Arg_UserTags); ok { + body.UserTags = flex.FlattenSet(tags.(*schema.Set)) + } if v, ok := d.GetOk(helpers.PINetworkJumbo); ok { body.Jumbo = v.(bool) } @@ -223,6 +237,16 @@ func resourceIBMPINetworkCreate(ctx context.Context, d *schema.ResourceData, met return diag.FromErr(err) } + if _, ok := d.GetOk(Arg_UserTags); ok { + if networkResponse.Crn != "" { + oldList, newList := d.GetChange(Arg_UserTags) + err := flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, string(networkResponse.Crn), "", UserTagType) + if err != nil { + log.Printf("Error on update of pi snapshot (%s) pi_user_tags during creation: %s", networkID, err) + } + } + } + return resourceIBMPINetworkRead(ctx, d, meta) } @@ -242,7 +266,14 @@ func resourceIBMPINetworkRead(ctx context.Context, d *schema.ResourceData, meta if err != nil { return diag.FromErr(err) } - + if networkdata.Crn != "" { + d.Set(Attr_CRN, networkdata.Crn) + tags, err := flex.GetGlobalTagsUsingCRN(meta, string(networkdata.Crn), "", UserTagType) + if err != nil { + log.Printf("Error on get of pi network (%s) pi_user_tags: %s", *networkdata.NetworkID, err) + } + d.Set(Arg_UserTags, tags) + } d.Set("network_id", networkdata.NetworkID) d.Set(helpers.PINetworkCidr, networkdata.Cidr) d.Set(helpers.PINetworkDNS, networkdata.DNSServers) @@ -310,6 +341,16 @@ func resourceIBMPINetworkUpdate(ctx context.Context, d *schema.ResourceData, met } } + if d.HasChange(Arg_UserTags) { + if crn, ok := d.GetOk(Attr_CRN); ok { + oldList, newList := d.GetChange(Arg_UserTags) + err := flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, crn.(string), "", UserTagType) + if err != nil { + log.Printf("Error on update of pi network (%s) pi_user_tags: %s", networkID, err) + } + } + } + return resourceIBMPINetworkRead(ctx, d, meta) } diff --git a/ibm/service/power/resource_ibm_pi_network_port_attach.go b/ibm/service/power/resource_ibm_pi_network_port_attach.go index e0e342e15a..99bb5adb05 100644 --- a/ibm/service/power/resource_ibm_pi_network_port_attach.go +++ b/ibm/service/power/resource_ibm_pi_network_port_attach.go @@ -63,6 +63,14 @@ func ResourceIBMPINetworkPortAttach() *schema.Resource { ForceNew: true, Computed: true, }, + Arg_UserTags: { + Description: "The user tags attached to this resource.", + Elem: &schema.Schema{Type: schema.TypeString}, + ForceNew: true, + Optional: true, + Set: schema.HashString, + Type: schema.TypeSet, + }, //Computed Attributes "macaddress": { @@ -101,7 +109,9 @@ func resourceIBMPINetworkPortAttachCreate(ctx context.Context, d *schema.Resourc ipaddress := v.(string) nwportBody.IPAddress = ipaddress } - + if tags, ok := d.GetOk(Arg_UserTags); ok { + nwportBody.UserTags = flex.FlattenSet(tags.(*schema.Set)) + } nwportattachBody := &models.NetworkPortUpdate{ Description: &description, PvmInstanceID: &instanceID, diff --git a/ibm/service/power/resource_ibm_pi_network_test.go b/ibm/service/power/resource_ibm_pi_network_test.go index cc55a7af24..b62dac6513 100644 --- a/ibm/service/power/resource_ibm_pi_network_test.go +++ b/ibm/service/power/resource_ibm_pi_network_test.go @@ -21,6 +21,7 @@ import ( func TestAccIBMPINetworkbasic(t *testing.T) { name := fmt.Sprintf("tf-pi-network-%d", acctest.RandIntRange(10, 100)) + networkRes := "ibm_pi_network.power_networks" resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, @@ -29,25 +30,22 @@ func TestAccIBMPINetworkbasic(t *testing.T) { { Config: testAccCheckIBMPINetworkConfig(name), Check: resource.ComposeTestCheckFunc( - testAccCheckIBMPINetworkExists("ibm_pi_network.power_networks"), - resource.TestCheckResourceAttr( - "ibm_pi_network.power_networks", "pi_network_name", name), - resource.TestCheckResourceAttrSet("ibm_pi_network.power_networks", "id"), - resource.TestCheckResourceAttrSet("ibm_pi_network.power_networks", "pi_gateway"), - resource.TestCheckResourceAttrSet("ibm_pi_network.power_networks", "pi_ipaddress_range.#"), + testAccCheckIBMPINetworkExists(networkRes), + resource.TestCheckResourceAttr(networkRes, "pi_network_name", name), + resource.TestCheckResourceAttrSet(networkRes, "id"), + resource.TestCheckResourceAttrSet(networkRes, "pi_gateway"), + resource.TestCheckResourceAttrSet(networkRes, "pi_ipaddress_range.#"), ), }, { Config: testAccCheckIBMPINetworkConfigUpdateDNS(name), Check: resource.ComposeTestCheckFunc( - testAccCheckIBMPINetworkExists("ibm_pi_network.power_networks"), - resource.TestCheckResourceAttr( - "ibm_pi_network.power_networks", "pi_network_name", name), - resource.TestCheckResourceAttr( - "ibm_pi_network.power_networks", "pi_dns.#", "1"), - resource.TestCheckResourceAttrSet("ibm_pi_network.power_networks", "id"), - resource.TestCheckResourceAttrSet("ibm_pi_network.power_networks", "pi_gateway"), - resource.TestCheckResourceAttrSet("ibm_pi_network.power_networks", "pi_ipaddress_range.#"), + testAccCheckIBMPINetworkExists(networkRes), + resource.TestCheckResourceAttr(networkRes, "pi_network_name", name), + resource.TestCheckResourceAttr(networkRes, "pi_dns.#", "1"), + resource.TestCheckResourceAttrSet(networkRes, "id"), + resource.TestCheckResourceAttrSet(networkRes, "pi_gateway"), + resource.TestCheckResourceAttrSet(networkRes, "pi_ipaddress_range.#"), ), }, }, @@ -102,7 +100,6 @@ func TestAccIBMPINetworkGatewaybasicSatellite(t *testing.T) { testAccCheckIBMPINetworkExists("ibm_pi_network.power_networks"), resource.TestCheckResourceAttr( "ibm_pi_network.power_networks", "pi_network_name", name), - resource.TestCheckResourceAttrSet("ibm_pi_network.power_networks", "pi_gateway"), resource.TestCheckResourceAttrSet("ibm_pi_network.power_networks", "id"), resource.TestCheckResourceAttrSet("ibm_pi_network.power_networks", "pi_ipaddress_range.#"), ), @@ -113,8 +110,6 @@ func TestAccIBMPINetworkGatewaybasicSatellite(t *testing.T) { testAccCheckIBMPINetworkExists("ibm_pi_network.power_networks"), resource.TestCheckResourceAttr( "ibm_pi_network.power_networks", "pi_network_name", name), - resource.TestCheckResourceAttr( - "ibm_pi_network.power_networks", "pi_gateway", "192.168.17.2"), resource.TestCheckResourceAttr( "ibm_pi_network.power_networks", "pi_ipaddress_range.0.pi_ending_ip_address", "192.168.17.254"), resource.TestCheckResourceAttr( @@ -157,6 +152,43 @@ func TestAccIBMPINetworkDHCPbasic(t *testing.T) { }) } +func TestAccIBMPINetworkUserTags(t *testing.T) { + name := fmt.Sprintf("tf-pi-network-%d", acctest.RandIntRange(10, 100)) + networkRes := "ibm_pi_network.power_networks" + userTagsString := `["env:dev","test_tag"]` + userTagsStringUpdated := `["env:dev","test_tag","test_tag2"]` + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMPINetworkDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMPINetworkUserTagsConfig(name, userTagsString), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMPINetworkExists(networkRes), + resource.TestCheckResourceAttr(networkRes, "pi_network_name", name), + resource.TestCheckResourceAttrSet(networkRes, "id"), + resource.TestCheckResourceAttr(networkRes, "pi_user_tags.#", "2"), + resource.TestCheckTypeSetElemAttr(networkRes, "pi_user_tags.*", "env:dev"), + resource.TestCheckTypeSetElemAttr(networkRes, "pi_user_tags.*", "test_tag"), + ), + }, + { + Config: testAccCheckIBMPINetworkUserTagsConfig(name, userTagsStringUpdated), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMPINetworkExists(networkRes), + resource.TestCheckResourceAttr(networkRes, "pi_network_name", name), + resource.TestCheckResourceAttrSet(networkRes, "id"), + resource.TestCheckResourceAttr(networkRes, "pi_user_tags.#", "3"), + resource.TestCheckTypeSetElemAttr(networkRes, "pi_user_tags.*", "env:dev"), + resource.TestCheckTypeSetElemAttr(networkRes, "pi_user_tags.*", "test_tag"), + resource.TestCheckTypeSetElemAttr(networkRes, "pi_user_tags.*", "test_tag2"), + ), + }, + }, + }) +} + func testAccCheckIBMPINetworkDestroy(s *terraform.State) error { sess, err := acc.TestAccProvider.Meta().(conns.ClientSession).IBMPISession() if err != nil { @@ -263,7 +295,6 @@ func testAccCheckIBMPINetworkConfigGatewayUpdateDNS(name string) string { pi_network_name = "%s" pi_network_type = "vlan" pi_dns = ["127.0.0.1"] - pi_gateway = "192.168.17.2" pi_cidr = "192.168.17.0/24" pi_ipaddress_range { pi_ending_ip_address = "192.168.17.254" @@ -296,3 +327,14 @@ func testAccCheckIBMPINetworkConfigGatewayDHCPUpdateDNS(name string) string { } `, acc.Pi_cloud_instance_id, name) } + +func testAccCheckIBMPINetworkUserTagsConfig(name string, userTagsString string) string { + return fmt.Sprintf(` + resource "ibm_pi_network" "power_networks" { + pi_cloud_instance_id = "%s" + pi_network_name = "%s" + pi_network_type = "pub-vlan" + pi_user_tags = %s + } + `, acc.Pi_cloud_instance_id, name, userTagsString) +} diff --git a/website/docs/d/pi_network.html.markdown b/website/docs/d/pi_network.html.markdown index 30635fd315..befcce7a1c 100644 --- a/website/docs/d/pi_network.html.markdown +++ b/website/docs/d/pi_network.html.markdown @@ -43,6 +43,7 @@ In addition to all argument reference list, you can access the following attribu - `access_config` - (String) The network communication configuration option of the network (for satellite locations only). - `available_ip_count` - (Float) The total number of IP addresses that you have in your network. - `cidr` - (String) The CIDR of the network. +- `crn` - (String) The CRN of this resource. - `dns`- (Set) The DNS Servers for the network. - `gateway` - (String) The network gateway that is attached to your network. - `id` - (String) The ID of the network. @@ -51,4 +52,5 @@ In addition to all argument reference list, you can access the following attribu - `type` - (String) The type of network. - `used_ip_count` - (Float) The number of used IP addresses. - `used_ip_percent` - (Float) The percentage of IP addresses used. +- `user_tags` - (List) List of user tags attached to the resource. - `vlan_id` - (String) The VLAN ID that the network is connected to. diff --git a/website/docs/d/pi_networks.html.markdown b/website/docs/d/pi_networks.html.markdown index 4461cacd9a..2b030d6165 100644 --- a/website/docs/d/pi_networks.html.markdown +++ b/website/docs/d/pi_networks.html.markdown @@ -42,10 +42,12 @@ In addition to all argument reference list, you can access the following attribu Nested scheme for `networks`: - `access_config` - (String) The network communication configuration option of the network (for satellite locations only). + - `crn` - (String) The CRN of this resource. - `dhcp_managed` - (Boolean) Indicates if the network DHCP Managed. - `href` - (String) The hyper link of a network. - `mtu` - (Boolean) Maximum Transmission Unit option of the network. - `name` - (String) The name of a network. - `network_id` - (String) The ID of the network. - `type` - (String) The type of network. + - `user_tags` - (List) List of user tags attached to the resource. - `vlan_id` - (String) The VLAN ID that the network is connected to. diff --git a/website/docs/d/pi_public_network.html.markdown b/website/docs/d/pi_public_network.html.markdown index 097d94ce6a..f1ecb789ac 100644 --- a/website/docs/d/pi_public_network.html.markdown +++ b/website/docs/d/pi_public_network.html.markdown @@ -39,6 +39,7 @@ Review the argument references that you can specify for your data source. ## Attribute reference In addition to all argument reference list, you can access the following attribute references after your data source is created. +- `crn` - (String) The CRN of this resource. - `id` - (String) The ID of the network. - `name` - (String) The name of the network. - `type` - (String) The type of VLAN that the network is connected to. diff --git a/website/docs/r/pi_network.html.markdown b/website/docs/r/pi_network.html.markdown index b74018f7c4..e8ece20e93 100644 --- a/website/docs/r/pi_network.html.markdown +++ b/website/docs/r/pi_network.html.markdown @@ -72,11 +72,13 @@ Review the argument references that you can specify for your resource. - `pi_network_jumbo` - (Deprecated, Optional, Bool) MTU Jumbo option of the network (for multi-zone locations only). - `pi_network_mtu` - (Optional, Integer) Maximum Transmission Unit option of the network, min size = 1450 & max size = 9000. - `pi_network_access_config` - (Optional, String) The network communication configuration option of the network (for satellite locations only). +- `pi_user_tags` - (Optional, List) The user tags attached to this resource. ## Attribute reference In addition to all argument reference list, you can access the following attribute reference after your resource is created. +- `crn` - (String) The CRN of this resource. - `id` - (String) The unique identifier of the network. The ID is composed of `/`. - `network_id` - (String) The unique identifier of the network. - `vlan_id` - (Integer) The ID of the VLAN that your network is attached to. diff --git a/website/docs/r/pi_network_port_attach.html.markdown b/website/docs/r/pi_network_port_attach.html.markdown index b12d5b2a7f..e55c6badc4 100644 --- a/website/docs/r/pi_network_port_attach.html.markdown +++ b/website/docs/r/pi_network_port_attach.html.markdown @@ -54,6 +54,7 @@ Review the argument references that you can specify for your resource. - `pi_network_name` - (Required, String) The network ID or name. - `pi_network_port_description` - (Optional, String) The description for the Network Port. - `pi_network_port_ipaddress` - (Optional, String) The requested ip address of this port. +- `pi_user_tags` - (Optional, List) The user tags attached to this resource. ## Attribute reference In addition to all argument reference list, you can access the following attribute reference after your resource is created.