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

Terraform plan diff improvements #123

Merged
merged 4 commits into from
Feb 2, 2023
Merged
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
5 changes: 4 additions & 1 deletion docs/resources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,10 @@ Required:
Optional:

- `iops` (String) IOPS for the selected volume. It can be set to different values depending on your volume type and properties.
- `throughput` (String) Throughput.

Read-Only:

- `throughput` (String) Throughput is automatically calculated by BigAnimal based on the IOPS input.


<a id="nestedblock--allowed_ip_ranges"></a>
Expand Down
11 changes: 9 additions & 2 deletions pkg/provider/resource_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,23 @@ func (c *ClusterResource) Schema() *schema.Resource {
Description: "IOPS for the selected volume. It can be set to different values depending on your volume type and properties.",
Type: schema.TypeString,
Optional: true,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
// iops is an optional field.
// If there is already a value set (old != "")
// and there is no new value (new == ""),
// we can suppress this Diff
return new == "" && old != ""
},
},
"size": {
Description: "Size of the volume. It can be set to different values depending on your volume type and properties.",
Type: schema.TypeString,
Required: true,
},
"throughput": {
Description: "Throughput.",
Description: "Throughput is automatically calculated by BigAnimal based on the IOPS input.",
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"volume_properties": {
Description: "Volume properties in accordance with the selected volume type.",
Expand Down