Altinity / terraform-provider-altinitycloud

Terraform provider for Altinity.Cloud ☁️
https://registry.terraform.io/providers/altinity/altinitycloud/latest/docs
Apache License 2.0
7 stars 0 forks source link

capacity_per_zone attribute value type error handling is not specific #82

Closed Elmo33 closed 1 week ago

Elmo33 commented 1 month ago

when capacity_per_zone is not an int terraform doesn't specify that the capacity_per_zone's value is the issue and returns this error instead:

╷
│ Error: Incorrect attribute value type
│ 
│   on main.tf line 35, in resource "altinitycloud_env_aws" "this":
│   35:   node_groups = [{"name": 0, "node_type": "large.m6i", "capacity_per_zone": "5", "reservations": ["CLICKHOUSE", "SYSTEM", "ZOOKEEPER"]}]
│ 
│ Inappropriate value for attribute "node_groups": a number is required.

while it should look like this ( incorrect value works fine)

╷
│ Error: Invalid Attribute Value
│ 
│   with altinitycloud_env_aws.this,
│   on main.tf line 35, in resource "altinitycloud_env_aws" "this":
│   35:   node_groups = [{"name": 0, "node_type": "large.m6i", "capacity_per_zone": 0, "reservations": ["CLICKHOUSE", "SYSTEM", "ZOOKEEPER"]}]
│ 
│ Attribute node_groups[Value({"capacity_per_zone":0,"name":"0","node_type":"large.m6i","reservations":["CLICKHOUSE","SYSTEM","ZOOKEEPER"],"zones":<null>})].capacity_per_zone value must be at least 1, got: 0
╵
Elmo33 commented 1 month ago

works fine with list value type error:

╷
│ Error: Incorrect attribute value type
│ 
│   on main.tf line 35, in resource "altinitycloud_env_aws" "this":
│   35:   node_groups = [{"name": "t4g.large", "node_type": "t4g.large", "capacity_per_zone": [1], "reservations": ["CLICKHOUSE", "SYSTEM", "ZOOKEEPER"]}]
│ 
│ Inappropriate value for attribute "node_groups": element 0: attribute "capacity_per_zone": number required.
╵
ianaya89 commented 1 week ago

There are 2 different things here:

  1. Expected type conversion from HCL when using "1" instead of 1. This is the same as explained in #83
  2. Incomplete error message when using a non integer string, it's an issue of the terraform-plugin-framework. I reported the issue https://github.com/hashicorp/terraform-plugin-framework/issues/1032