coder / coder/terraform-provider-coderd

resource `coderd_template` doesn't handle initial failed creation gracefully

Open
#271 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
29
Forks
13
Avg merge
1d 20h
Merged PRs (30d)
20

Description

Provider Version: 0.0.12

If the `coderd_template` fails it's initial create sequence, it's not able to gracefully continue. For example, this was the first error that had occurred:
```
│ Error: Client Error

│ with coderd_template.test,
│ on main.tf line 14, in resource "coderd_template" "test":
│ 14: resource "coderd_template" "test" {

│ Failed to create template ACL: PATCH https://rs97pvo65hdfo.pit-1.try.coder.app/api/v2/templates/5ca8e2fc-caf9-47c2-a8a2-ce2189ff770d/acl:
│ unexpected status code 400: Invalid request to update template ACL
│ group_perms: role "Use" is not a valid template role
│ group_perms: Everyone is not a valid UUID.
```

After resolving it and attempting another `terraform apply`, it'll indicate that the template is already created:
```
│ Error: Client Error

│ with coderd_template.test,
│ on main.tf line 14, in resource "coderd_template" "test":
│ 14: resource "coderd_template" "test" {

│ Failed to create template: POST
│ https://rs97pvo65hdfo.pit-1.try.coder.app/api/v2/organizations/cee07bdd-0e0d-4ca7-802f-92497067ae30/templates: unexpected status code 409:
│ Template with name "test" already exists.
│ name: This value is already in use and should be unique.
```

I expected that the template wouldn't have been created since it failed, or the provider would automatically handle updating it correctly with my desired changes instead.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.