Skip to content

Commit 7c3ca59

Browse files
authored
Merge pull request #44401 from oracle-community/apply-valid-planmodifires
r/odb: Apply valid planmodifires
2 parents cbad3ff + a736645 commit 7c3ca59

File tree

4 files changed

+251
-57
lines changed

4 files changed

+251
-57
lines changed

.changelog/44401.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
```release-note:bug
2+
resource/aws_odb_cloud_vm_cluster : Fixed planmodifier for computed attribute. Fixed planmodifier from display_name attribute.
3+
```
4+
5+
```release-note:bug
6+
resource/aws_odb_cloud_autonomous_vm_cluster : Fixed planmodifier for computed attribute.
7+
```
8+
9+
```release-note:bug
10+
resource/aws_odb_network_peering_connection : Fixed planmodifier for computed attribute.
11+
```

internal/service/odb/cloud_autonomous_vm_cluster.go

Lines changed: 127 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"github.com/hashicorp/terraform-plugin-framework/resource"
2020
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
2121
"github.com/hashicorp/terraform-plugin-framework/resource/schema/boolplanmodifier"
22+
"github.com/hashicorp/terraform-plugin-framework/resource/schema/float32planmodifier"
2223
"github.com/hashicorp/terraform-plugin-framework/resource/schema/float64planmodifier"
2324
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int32planmodifier"
2425
"github.com/hashicorp/terraform-plugin-framework/resource/schema/listplanmodifier"
@@ -83,7 +84,10 @@ func (r *resourceCloudAutonomousVmCluster) Schema(ctx context.Context, req resou
8384
Description: "Exadata infrastructure id. Changing this will force terraform to create new resource.",
8485
},
8586
"autonomous_data_storage_percentage": schema.Float32Attribute{
86-
Computed: true,
87+
Computed: true,
88+
PlanModifiers: []planmodifier.Float32{
89+
float32planmodifier.UseStateForUnknown(),
90+
},
8791
Description: "The progress of the current operation on the Autonomous VM cluster, as a percentage.",
8892
},
8993
"autonomous_data_storage_size_in_tbs": schema.Float64Attribute{
@@ -94,24 +98,39 @@ func (r *resourceCloudAutonomousVmCluster) Schema(ctx context.Context, req resou
9498
Description: "The data storage size allocated for Autonomous Databases in the Autonomous VM cluster, in TB. Changing this will force terraform to create new resource.",
9599
},
96100
"available_autonomous_data_storage_size_in_tbs": schema.Float64Attribute{
97-
Computed: true,
101+
Computed: true,
102+
PlanModifiers: []planmodifier.Float64{
103+
float64planmodifier.UseStateForUnknown(),
104+
},
98105
Description: "The available data storage space for Autonomous Databases in the Autonomous VM cluster, in TB.",
99106
},
100107
"available_container_databases": schema.Int32Attribute{
101-
Computed: true,
108+
Computed: true,
109+
PlanModifiers: []planmodifier.Int32{
110+
int32planmodifier.UseStateForUnknown(),
111+
},
102112
Description: "The number of Autonomous CDBs that you can create with the currently available storage.",
103113
},
104114
"available_cpus": schema.Float32Attribute{
105-
Computed: true,
115+
Computed: true,
116+
PlanModifiers: []planmodifier.Float32{
117+
float32planmodifier.UseStateForUnknown(),
118+
},
106119
Description: "The number of CPU cores available for allocation to Autonomous Databases",
107120
},
108121
"compute_model": schema.StringAttribute{
109-
CustomType: computeModel,
110-
Computed: true,
122+
CustomType: computeModel,
123+
Computed: true,
124+
PlanModifiers: []planmodifier.String{
125+
stringplanmodifier.UseStateForUnknown(),
126+
},
111127
Description: "The compute model of the Autonomous VM cluster: ECPU or OCPU.",
112128
},
113129
"cpu_core_count": schema.Int32Attribute{
114-
Computed: true,
130+
Computed: true,
131+
PlanModifiers: []planmodifier.Int32{
132+
int32planmodifier.UseStateForUnknown(),
133+
},
115134
Description: "The total number of CPU cores in the Autonomous VM cluster.",
116135
},
117136
"cpu_core_count_per_node": schema.Int32Attribute{
@@ -122,24 +141,39 @@ func (r *resourceCloudAutonomousVmCluster) Schema(ctx context.Context, req resou
122141
Description: "The number of CPU cores enabled per node in the Autonomous VM cluster.",
123142
},
124143
"cpu_percentage": schema.Float32Attribute{
125-
Computed: true,
144+
Computed: true,
145+
PlanModifiers: []planmodifier.Float32{
146+
float32planmodifier.UseStateForUnknown(),
147+
},
126148
Description: "The percentage of total CPU cores currently in use in the Autonomous VM cluster.",
127149
},
128150
names.AttrCreatedAt: schema.StringAttribute{
129-
Computed: true,
151+
Computed: true,
152+
PlanModifiers: []planmodifier.String{
153+
stringplanmodifier.UseStateForUnknown(),
154+
},
130155
CustomType: timetypes.RFC3339Type{},
131156
Description: "The date and time when the Autonomous VM cluster was created.",
132157
},
133158
"data_storage_size_in_gbs": schema.Float64Attribute{
134-
Computed: true,
159+
Computed: true,
160+
PlanModifiers: []planmodifier.Float64{
161+
float64planmodifier.UseStateForUnknown(),
162+
},
135163
Description: "The total data storage allocated to the Autonomous VM cluster, in GB.",
136164
},
137165
"data_storage_size_in_tbs": schema.Float64Attribute{
138-
Computed: true,
166+
Computed: true,
167+
PlanModifiers: []planmodifier.Float64{
168+
float64planmodifier.UseStateForUnknown(),
169+
},
139170
Description: "The total data storage allocated to the Autonomous VM cluster, in TB.",
140171
},
141172
"odb_node_storage_size_in_gbs": schema.Int32Attribute{
142-
Computed: true,
173+
Computed: true,
174+
PlanModifiers: []planmodifier.Int32{
175+
int32planmodifier.UseStateForUnknown(),
176+
},
143177
Description: " The local node storage allocated to the Autonomous VM cluster, in gigabytes (GB)",
144178
},
145179
"db_servers": schema.SetAttribute{
@@ -167,11 +201,17 @@ func (r *resourceCloudAutonomousVmCluster) Schema(ctx context.Context, req resou
167201
Description: "The display name of the Autonomous VM cluster. Changing this will force terraform to create new resource.",
168202
},
169203
names.AttrDomain: schema.StringAttribute{
170-
Computed: true,
204+
Computed: true,
205+
PlanModifiers: []planmodifier.String{
206+
stringplanmodifier.UseStateForUnknown(),
207+
},
171208
Description: "The domain name of the Autonomous VM cluster.",
172209
},
173210
"exadata_storage_in_tbs_lowest_scaled_value": schema.Float64Attribute{
174-
Computed: true,
211+
Computed: true,
212+
PlanModifiers: []planmodifier.Float64{
213+
float64planmodifier.UseStateForUnknown(),
214+
},
175215
Description: "The minimum value to which you can scale down the Exadata storage, in TB.",
176216
},
177217
"hostname": schema.StringAttribute{
@@ -201,7 +241,10 @@ func (r *resourceCloudAutonomousVmCluster) Schema(ctx context.Context, req resou
201241
Description: "The license model for the Autonomous VM cluster. Valid values are LICENSE_INCLUDED or BRING_YOUR_OWN_LICENSE . Changing this will force terraform to create new resource.",
202242
},
203243
"max_acds_lowest_scaled_value": schema.Int32Attribute{
204-
Computed: true,
244+
Computed: true,
245+
PlanModifiers: []planmodifier.Int32{
246+
int32planmodifier.UseStateForUnknown(),
247+
},
205248
Description: "The minimum value to which you can scale down the maximum number of Autonomous CDBs.",
206249
},
207250
"memory_per_oracle_compute_unit_in_gbs": schema.Int32Attribute{
@@ -212,27 +255,45 @@ func (r *resourceCloudAutonomousVmCluster) Schema(ctx context.Context, req resou
212255
Description: "The amount of memory allocated per Oracle Compute Unit, in GB. Changing this will force terraform to create new resource.",
213256
},
214257
"memory_size_in_gbs": schema.Int32Attribute{
215-
Computed: true,
258+
Computed: true,
259+
PlanModifiers: []planmodifier.Int32{
260+
int32planmodifier.UseStateForUnknown(),
261+
},
216262
Description: "The total amount of memory allocated to the Autonomous VM cluster, in gigabytes(GB).",
217263
},
218264
"node_count": schema.Int32Attribute{
219-
Computed: true,
265+
Computed: true,
266+
PlanModifiers: []planmodifier.Int32{
267+
int32planmodifier.UseStateForUnknown(),
268+
},
220269
Description: "The number of database server nodes in the Autonomous VM cluster.",
221270
},
222271
"non_provisionable_autonomous_container_databases": schema.Int32Attribute{
223-
Computed: true,
272+
Computed: true,
273+
PlanModifiers: []planmodifier.Int32{
274+
int32planmodifier.UseStateForUnknown(),
275+
},
224276
Description: "The number of Autonomous CDBs that can't be provisioned because of resource constraints.",
225277
},
226278
"oci_resource_anchor_name": schema.StringAttribute{
227-
Computed: true,
279+
Computed: true,
280+
PlanModifiers: []planmodifier.String{
281+
stringplanmodifier.UseStateForUnknown(),
282+
},
228283
Description: "The name of the OCI resource anchor associated with this Autonomous VM cluster.",
229284
},
230285
"oci_url": schema.StringAttribute{
231-
Computed: true,
286+
Computed: true,
287+
PlanModifiers: []planmodifier.String{
288+
stringplanmodifier.UseStateForUnknown(),
289+
},
232290
Description: "The URL for accessing the OCI console page for this Autonomous VM cluster.",
233291
},
234292
"ocid": schema.StringAttribute{
235-
Computed: true,
293+
Computed: true,
294+
PlanModifiers: []planmodifier.String{
295+
stringplanmodifier.UseStateForUnknown(),
296+
},
236297
Description: "The Oracle Cloud Identifier (OCID) of the Autonomous VM cluster.",
237298
},
238299
"odb_network_id": schema.StringAttribute{
@@ -243,27 +304,45 @@ func (r *resourceCloudAutonomousVmCluster) Schema(ctx context.Context, req resou
243304
Description: "The unique identifier of the ODB network associated with this Autonomous VM Cluster. Changing this will force terraform to create new resource.",
244305
},
245306
"percent_progress": schema.Float32Attribute{
246-
Computed: true,
307+
Computed: true,
308+
PlanModifiers: []planmodifier.Float32{
309+
float32planmodifier.UseStateForUnknown(),
310+
},
247311
Description: `The progress of the current operation on the Autonomous VM cluster, as a percentage.`,
248312
},
249313
"provisionable_autonomous_container_databases": schema.Int32Attribute{
250-
Computed: true,
314+
Computed: true,
315+
PlanModifiers: []planmodifier.Int32{
316+
int32planmodifier.UseStateForUnknown(),
317+
},
251318
Description: "The number of Autonomous CDBs that can be provisioned in the Autonomous VM cluster.",
252319
},
253320
"provisioned_autonomous_container_databases": schema.Int32Attribute{
254-
Computed: true,
321+
Computed: true,
322+
PlanModifiers: []planmodifier.Int32{
323+
int32planmodifier.UseStateForUnknown(),
324+
},
255325
Description: "The number of Autonomous CDBs currently provisioned in the Autonomous VM cluster.",
256326
},
257327
"provisioned_cpus": schema.Float32Attribute{
258-
Computed: true,
328+
Computed: true,
329+
PlanModifiers: []planmodifier.Float32{
330+
float32planmodifier.UseStateForUnknown(),
331+
},
259332
Description: "The number of CPUs provisioned in the Autonomous VM cluster.",
260333
},
261334
"reclaimable_cpus": schema.Float32Attribute{
262-
Computed: true,
335+
Computed: true,
336+
PlanModifiers: []planmodifier.Float32{
337+
float32planmodifier.UseStateForUnknown(),
338+
},
263339
Description: "The number of CPU cores that can be reclaimed from terminated or scaled-down Autonomous Databases.",
264340
},
265341
"reserved_cpus": schema.Float32Attribute{
266-
Computed: true,
342+
Computed: true,
343+
PlanModifiers: []planmodifier.Float32{
344+
float32planmodifier.UseStateForUnknown(),
345+
},
267346
Description: "The number of CPU cores reserved for system operations and redundancy.",
268347
},
269348
"scan_listener_port_non_tls": schema.Int32Attribute{
@@ -281,16 +360,25 @@ func (r *resourceCloudAutonomousVmCluster) Schema(ctx context.Context, req resou
281360
Description: "The SCAN listener port for TLS (TCP) protocol. The default is 2484. Changing this will force terraform to create new resource.",
282361
},
283362
"shape": schema.StringAttribute{
284-
Computed: true,
363+
Computed: true,
364+
PlanModifiers: []planmodifier.String{
365+
stringplanmodifier.UseStateForUnknown(),
366+
},
285367
Description: "The shape of the Exadata infrastructure for the Autonomous VM cluster.",
286368
},
287369
names.AttrStatus: schema.StringAttribute{
288-
CustomType: status,
289-
Computed: true,
370+
CustomType: status,
371+
Computed: true,
372+
PlanModifiers: []planmodifier.String{
373+
stringplanmodifier.UseStateForUnknown(),
374+
},
290375
Description: "The status of the Autonomous VM cluster. Possible values include CREATING, AVAILABLE , UPDATING , DELETING , DELETED , FAILED ",
291376
},
292377
names.AttrStatusReason: schema.StringAttribute{
293-
Computed: true,
378+
Computed: true,
379+
PlanModifiers: []planmodifier.String{
380+
stringplanmodifier.UseStateForUnknown(),
381+
},
294382
Description: "Additional information about the current status of the Autonomous VM cluster.",
295383
},
296384
"time_zone": schema.StringAttribute{
@@ -310,11 +398,17 @@ func (r *resourceCloudAutonomousVmCluster) Schema(ctx context.Context, req resou
310398
Description: "The total number of Autonomous Container Databases that can be created with the allocated local storage. Changing this will force terraform to create new resource.",
311399
},
312400
"time_ords_certificate_expires": schema.StringAttribute{
313-
Computed: true,
401+
Computed: true,
402+
PlanModifiers: []planmodifier.String{
403+
stringplanmodifier.UseStateForUnknown(),
404+
},
314405
CustomType: timetypes.RFC3339Type{},
315406
},
316407
"time_database_ssl_certificate_expires": schema.StringAttribute{
317-
Computed: true,
408+
Computed: true,
409+
PlanModifiers: []planmodifier.String{
410+
stringplanmodifier.UseStateForUnknown(),
411+
},
318412
CustomType: timetypes.RFC3339Type{},
319413
Description: "The expiration date and time of the database SSL certificate.",
320414
},

0 commit comments

Comments
 (0)