Skip to content

resource coderd_template doesn't handle initial failed creation gracefully #271

Description

@jatcod3r

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions