Skip to content

Commit

Permalink
Update Forcenew instance fields (#5025)
Browse files Browse the repository at this point in the history
* Add forcenew field markings for instance

* Update forcenew fields

* Revert imageid forcenew

The image id you pass in does not match the image id of the instance
created, so if you apply twice in row terraform thinks it has to
remake the instance when that's not true.
  • Loading branch information
ismirlia authored Feb 5, 2024
1 parent 579dab5 commit 39adf82
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions ibm/service/power/resource_ibm_pi_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,19 @@ func ResourceIBMPIInstance() *schema.Resource {
Description: "Maximum memory size",
},
helpers.PIInstanceVolumeIds: {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString,
DiffSuppressFunc: flex.ApplyOnce,
Description: "List of PI volumes",
Type: schema.TypeSet,
ForceNew: true,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString,
Description: "List of PI volumes",
},

helpers.PIInstanceUserData: {
Type: schema.TypeString,
ForceNew: true,
Optional: true,
Description: "Base64 encoded data to be passed in for invoking a cloud init script",
},

helpers.PIInstanceStorageType: {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -154,10 +153,10 @@ func ResourceIBMPIInstance() *schema.Resource {
Description: "Indicates if all volumes attached to the server must reside in the same storage pool",
},
PIInstanceNetwork: {
Type: schema.TypeList,
Required: true,
DiffSuppressFunc: flex.ApplyOnce,
Description: "List of one or more networks to attach to the instance",
Type: schema.TypeList,
ForceNew: true,
Required: true,
Description: "List of one or more networks to attach to the instance",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"ip_address": {
Expand Down Expand Up @@ -190,13 +189,14 @@ func ResourceIBMPIInstance() *schema.Resource {
},
helpers.PIPlacementGroupID: {
Type: schema.TypeString,
ForceNew: true,
Optional: true,
Description: "Placement group ID",
},
Arg_PIInstanceSharedProcessorPool: {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Optional: true,
ConflictsWith: []string{PISAPInstanceProfileID},
Description: "Shared Processor Pool the instance is deployed on",
},
Expand Down Expand Up @@ -247,10 +247,10 @@ func ResourceIBMPIInstance() *schema.Resource {
Description: "Instance processor type",
},
helpers.PIInstanceSSHKeyName: {
Type: schema.TypeString,
Optional: true,
DiffSuppressFunc: flex.ApplyOnce,
Description: "SSH key name",
Type: schema.TypeString,
ForceNew: true,
Optional: true,
Description: "SSH key name",
},
helpers.PIInstanceMemory: {
Type: schema.TypeFloat,
Expand All @@ -261,6 +261,7 @@ func ResourceIBMPIInstance() *schema.Resource {
},
PIInstanceDeploymentType: {
Type: schema.TypeString,
ForceNew: true,
Optional: true,
Description: "Custom Deployment Type Information",
},
Expand All @@ -272,30 +273,35 @@ func ResourceIBMPIInstance() *schema.Resource {
},
PISAPInstanceDeploymentType: {
Type: schema.TypeString,
ForceNew: true,
Optional: true,
Description: "Custom SAP Deployment Type Information",
},
helpers.PIInstanceSystemType: {
Type: schema.TypeString,
ForceNew: true,
Optional: true,
Computed: true,
Description: "PI Instance system type",
},
helpers.PIInstanceReplicants: {
Type: schema.TypeInt,
ForceNew: true,
Optional: true,
Default: 1,
Description: "PI Instance replicas count",
},
helpers.PIInstanceReplicationPolicy: {
Type: schema.TypeString,
ForceNew: true,
Optional: true,
ValidateFunc: validate.ValidateAllowedStringValues([]string{"affinity", "anti-affinity", "none"}),
Default: "none",
Description: "Replication policy for the PI Instance",
},
helpers.PIInstanceReplicationScheme: {
Type: schema.TypeString,
ForceNew: true,
Optional: true,
ValidateFunc: validate.ValidateAllowedStringValues([]string{"prefix", "suffix"}),
Default: "suffix",
Expand Down

0 comments on commit 39adf82

Please sign in to comment.