Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor deprecated fields and messages #18

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ibm/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,6 @@ func Provider() *schema.Provider {
"ibm_pi_capture": power.ResourceIBMPICapture(),
"ibm_pi_image": power.ResourceIBMPIImage(),
"ibm_pi_image_export": power.ResourceIBMPIImageExport(),
"ibm_pi_network_port": power.ResourceIBMPINetworkPort(),
"ibm_pi_snapshot": power.ResourceIBMPISnapshot(),
"ibm_pi_network_port_attach": power.ResourceIBMPINetworkPortAttach(),
"ibm_pi_dhcp": power.ResourceIBMPIDhcp(),
Expand Down
6 changes: 0 additions & 6 deletions ibm/service/power/data_source_ibm_pi_dhcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ func DataSourceIBMPIDhcp() *schema.Resource {
},
},
},
Attr_DhcpNetworkDeprecated: {
Type: schema.TypeString,
Computed: true,
Description: "The ID of the DHCP Server private network (deprecated - replaced by network_id)",
},
Attr_DhcpNetworkID: {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -114,7 +109,6 @@ func dataSourceIBMPIDhcpRead(ctx context.Context, d *schema.ResourceData, meta i
if dhcpServer.Network != nil {
dhcpNetwork := dhcpServer.Network
if dhcpNetwork.ID != nil {
d.Set(Attr_DhcpNetworkDeprecated, *dhcpNetwork.ID)
d.Set(Attr_DhcpNetworkID, *dhcpNetwork.ID)
}
if dhcpNetwork.Name != nil {
Expand Down
6 changes: 0 additions & 6 deletions ibm/service/power/data_source_ibm_pi_dhcps.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ func DataSourceIBMPIDhcps() *schema.Resource {
Computed: true,
Description: "The ID of the DHCP Server",
},
Attr_DhcpNetworkDeprecated: {
Type: schema.TypeString,
Computed: true,
Description: "The ID of the DHCP Server private network (deprecated - replaced by network_id)",
},
Attr_DhcpNetworkID: {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -103,7 +98,6 @@ func dataSourceIBMPIDhcpServersRead(ctx context.Context, d *schema.ResourceData,
if dhcpServer.Network != nil {
dhcpNetwork := dhcpServer.Network
if dhcpNetwork.ID != nil {
d.Set(Attr_DhcpNetworkDeprecated, *dhcpNetwork.ID)
d.Set(Attr_DhcpNetworkID, *dhcpNetwork.ID)
}
if dhcpNetwork.Name != nil {
Expand Down
48 changes: 0 additions & 48 deletions ibm/service/power/data_source_ibm_pi_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,39 +52,6 @@ func DataSourceIBMPIInstance() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"addresses": {
Type: schema.TypeList,
Computed: true,
Deprecated: "This field is deprecated, use networks instead",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"ip": {
Type: schema.TypeString,
Computed: true,
},
"macaddress": {
Type: schema.TypeString,
Computed: true,
},
"network_id": {
Type: schema.TypeString,
Computed: true,
},
"network_name": {
Type: schema.TypeString,
Computed: true,
},
"type": {
Type: schema.TypeString,
Computed: true,
},
"external_ip": {
Type: schema.TypeString,
Computed: true,
},
},
},
},
"networks": {
Type: schema.TypeList,
Computed: true,
Expand Down Expand Up @@ -243,21 +210,6 @@ func dataSourceIBMPIInstancesRead(ctx context.Context, d *schema.ResourceData, m
d.Set(Attr_PIInstanceSharedProcessorPool, powervmdata.SharedProcessorPool)
d.Set(Attr_PIInstanceSharedProcessorPoolID, powervmdata.SharedProcessorPoolID)

if powervmdata.Addresses != nil {
pvmaddress := make([]map[string]interface{}, len(powervmdata.Addresses))
for i, pvmip := range powervmdata.Addresses {
p := make(map[string]interface{})
p["ip"] = pvmip.IPAddress
p["network_name"] = pvmip.NetworkName
p["network_id"] = pvmip.NetworkID
p["macaddress"] = pvmip.MacAddress
p["type"] = pvmip.Type
p["external_ip"] = pvmip.ExternalIP
pvmaddress[i] = p
}
d.Set("addresses", pvmaddress)
}

if powervmdata.Health != nil {
d.Set("health_status", powervmdata.Health.Status)
}
Expand Down
7 changes: 0 additions & 7 deletions ibm/service/power/data_source_ibm_pi_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@ func DataSourceIBMPIKey() *schema.Resource {
Computed: true,
Description: "SSH RSA key",
},
"sshkey": {
Type: schema.TypeString,
Sensitive: true,
Computed: true,
Deprecated: "This field is deprecated, use ssh_key instead",
},
},
}
}
Expand All @@ -78,7 +72,6 @@ func dataSourceIBMPIKeyRead(ctx context.Context, d *schema.ResourceData, meta in
d.SetId(*sshkeydata.Name)
d.Set(Attr_KeyCreationDate, sshkeydata.CreationDate.String())
d.Set(Attr_Key, sshkeydata.SSHKey)
d.Set("sshkey", sshkeydata.SSHKey) // TODO: deprecated, to remove

return nil
}
13 changes: 3 additions & 10 deletions ibm/service/power/data_source_ibm_pi_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,15 @@ func DataSourceIBMPINetwork() *schema.Resource {
Type: schema.TypeFloat,
Computed: true,
},
"name": {
Type: schema.TypeString,
Computed: true,
Deprecated: "This value is deprecated in favor of" + helpers.PINetworkName,
},
"dns": {
Type: schema.TypeSet,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"jumbo": {
Type: schema.TypeBool,
Computed: true,
Type: schema.TypeBool,
Computed: true,
Deprecated: "This field is deprecated, use mtu instead.",
},
"mtu": {
Type: schema.TypeInt,
Expand Down Expand Up @@ -123,9 +119,6 @@ func dataSourceIBMPINetworkRead(ctx context.Context, d *schema.ResourceData, met
if networkdata.IPAddressMetrics.Utilization != nil {
d.Set("used_ip_percent", networkdata.IPAddressMetrics.Utilization)
}
if networkdata.Name != nil {
d.Set("name", networkdata.Name)
}
if len(networkdata.DNSServers) > 0 {
d.Set("dns", networkdata.DNSServers)
}
Expand Down
6 changes: 0 additions & 6 deletions ibm/service/power/resource_ibm_pi_dhcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,6 @@ func ResourceIBMPIDhcp() *schema.Resource {
},
},
},
Attr_DhcpNetworkDeprecated: {
Type: schema.TypeString,
Computed: true,
Description: "The ID of the DHCP Server private network (deprecated - replaced by network_id)",
},
Attr_DhcpNetworkID: {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -210,7 +205,6 @@ func resourceIBMPIDhcpRead(ctx context.Context, d *schema.ResourceData, meta int
if dhcpServer.Network != nil {
dhcpNetwork := dhcpServer.Network
if dhcpNetwork.ID != nil {
d.Set(Attr_DhcpNetworkDeprecated, *dhcpNetwork.ID)
d.Set(Attr_DhcpNetworkID, *dhcpNetwork.ID)
}
if dhcpNetwork.Name != nil {
Expand Down
29 changes: 1 addition & 28 deletions ibm/service/power/resource_ibm_pi_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ func ResourceIBMPIInstance() *schema.Resource {
Computed: true,
Description: "PI instance status",
},
"pi_migratable": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
Description: "set to true to enable migration of the PI instance",
},
"min_processors": {
Type: schema.TypeFloat,
Computed: true,
Expand Down Expand Up @@ -313,12 +307,6 @@ func ResourceIBMPIInstance() *schema.Resource {
Default: "none",
ValidateFunc: validate.ValidateAllowedStringValues([]string{"none", "soft", "hard"}),
},

// "reboot_for_resource_change": {
// Type: schema.TypeString,
// Optional: true,
// Description: "Flag to be passed for CPU/Memory changes that require a reboot to take effect",
// },
"operating_system": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -435,9 +423,6 @@ func resourceIBMPIInstanceRead(ctx context.Context, d *schema.ResourceData, meta
d.Set("status", powervmdata.Status)
}
d.Set(helpers.PIInstanceProcType, powervmdata.ProcType)
if powervmdata.Migratable != nil {
d.Set("pi_migratable", powervmdata.Migratable)
}
d.Set("min_processors", powervmdata.Minproc)
d.Set(helpers.PIInstanceProgress, powervmdata.Progress)
if powervmdata.StorageType != nil {
Expand Down Expand Up @@ -598,7 +583,7 @@ func resourceIBMPIInstanceUpdate(ctx context.Context, d *schema.ResourceData, me
}

// Start of the change for Memory and Processors
if d.HasChange(helpers.PIInstanceMemory) || d.HasChange(helpers.PIInstanceProcessors) || d.HasChange("pi_migratable") {
if d.HasChange(helpers.PIInstanceMemory) || d.HasChange(helpers.PIInstanceProcessors) {

maxMemLpar := d.Get("max_memory").(float64)
maxCPULpar := d.Get("max_processors").(float64)
Expand Down Expand Up @@ -627,10 +612,6 @@ func resourceIBMPIInstanceUpdate(ctx context.Context, d *schema.ResourceData, me
Memory: mem,
Processors: procs,
}
if m, ok := d.GetOk("pi_migratable"); ok {
migratable := m.(bool)
body.Migratable = &migratable
}
if cores_enabled {
log.Printf("support for %s is enabled", CUSTOM_VIRTUAL_CORES)
body.VirtualCores = &models.VirtualCores{Assigned: &assignedVirtualCores}
Expand Down Expand Up @@ -1184,11 +1165,6 @@ func createPVMInstance(d *schema.ResourceData, client *st.IBMPIInstanceClient, i
if r, ok := d.GetOk(helpers.PIInstanceReplicationScheme); ok {
replicationNamingScheme = r.(string)
}
var migratable bool
if m, ok := d.GetOk("pi_migratable"); ok {
migratable = m.(bool)
}

var pinpolicy string
if p, ok := d.GetOk(helpers.PIInstancePinPolicy); ok {
pinpolicy = p.(string)
Expand All @@ -1202,9 +1178,7 @@ func createPVMInstance(d *schema.ResourceData, client *st.IBMPIInstanceClient, i
userData = u.(string)
}

//publicinterface := d.Get(helpers.PIInstancePublicNetwork).(bool)
body := &models.PVMInstanceCreate{
//NetworkIds: networks,
Processors: &procs,
Memory: &mem,
ServerName: flex.PtrToString(name),
Expand All @@ -1216,7 +1190,6 @@ func createPVMInstance(d *schema.ResourceData, client *st.IBMPIInstanceClient, i
ReplicantNamingScheme: flex.PtrToString(replicationNamingScheme),
ReplicantAffinityPolicy: flex.PtrToString(replicationpolicy),
Networks: pvmNetworks,
Migratable: &migratable,
}
if s, ok := d.GetOk(helpers.PIInstanceSSHKeyName); ok {
sshkey := s.(string)
Expand Down
6 changes: 0 additions & 6 deletions ibm/service/power/resource_ibm_pi_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ func ResourceIBMPIKey() *schema.Resource {
Computed: true,
Description: "Date of SSH Key creation",
},
Attr_KeyID: {
Type: schema.TypeString,
Computed: true,
Deprecated: "User defined name for the SSH key (deprecated - replaced by name)",
},
Attr_KeyName: {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -127,7 +122,6 @@ func resourceIBMPIKeyRead(ctx context.Context, d *schema.ResourceData, meta inte

// set attributes
d.Set(Attr_KeyName, sshkeydata.Name)
d.Set(Attr_KeyID, sshkeydata.Name)
d.Set(Attr_Key, sshkeydata.SSHKey)
d.Set(Attr_KeyCreationDate, sshkeydata.CreationDate.String())

Expand Down
12 changes: 6 additions & 6 deletions ibm/service/power/resource_ibm_pi_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ func ResourceIBMPINetwork() *schema.Resource {
Description: "PI network gateway",
},
helpers.PINetworkJumbo: {
Type: schema.TypeBool,
Optional: true,
Computed: true,
Deprecated: "deprecated use pi_network_mtu instead",
ConflictsWith: []string{helpers.PINetworkMtu},
Description: "PI network enable MTU Jumbo option",
Type: schema.TypeBool,
Optional: true,
Computed: true,
Deprecated: "This field is deprecated, use pi_network_mtu instead.",
ConflictsWith: []string{helpers.PINetworkMtu, helpers.PINetworkJumbo},
Description: "PI network enable MTU Jumbo option",
},
helpers.PINetworkMtu: {
Type: schema.TypeInt,
Expand Down
Loading
Loading