Commit 0dbc14d
committed
oxide_instance: add validation to ssh_public_keys attribute
Add validation to the `ssh_public_keys` attribute to validate that
it contains no empty or null values. A customer pointed out that the
following Terraform configuration resulted in an unclear error message.
```hcl
resource "oxide_instance" "example" {
ssh_public_keys = ["4db0f0d3-8e82-491a-beff-39764be1c529", null]
}
```
Even worse, the error message didn't occur until apply time.
```
oxide_instance.example: Creating...
╷
│ Error: Error retrieving name or ID information
│
│ with oxide_instance.example,
│ on main.tf line 22, in resource "oxide_instance" "example":
│ 22: resource "oxide_instance" "example" {
│
│ name or ID parse error: invalid syntax
╵
```
With this change, the error message occurs at plan time and is much
more clear.
```
> terraform apply
╷
│ Error: Null Set Value
│
│ with oxide_instance.example,
│ on main.tf line 31, in resource "oxide_instance" "example":
│ 31: ssh_public_keys = ["4db0f0d3-8e82-491a-beff-39764be1c529", null]
│
│ This attribute contains a null value.
╵
```1 parent 7478329 commit 0dbc14d
1 file changed
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
178 | 179 | | |
179 | 180 | | |
180 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
181 | 188 | | |
182 | 189 | | |
183 | 190 | | |
| |||
0 commit comments