terraform-provider-vault icon indicating copy to clipboard operation
terraform-provider-vault copied to clipboard

[Bug]: Introducing superfluous slashes into resource paths causes "Provider produced inconsistent result after apply"

Open jtv8 opened this issue 2 years ago • 0 comments

Terraform Core Version

1.5.4

Terraform Vault Provider Version

3.20.0

Vault Server Version

1.14.0

Affected Resource(s)

  • resource vault_auth_backend
  • resource vault_mount
  • (potentially all other resources using a path)

Expected Behavior

Accidentally introducing an additional slash in a Vault path - see examples in "Terraform Configuration Files" - and running terraform plan or terraform apply should result in a validation error during the plan phase.

No changes should be made to Vault.

Actual Behavior

Running terraform apply results in an "inconsistent result" crash. The resource is created in Vault before the crash, meaning that it has to be manually deleted or imported into the Terraform state in order to recover the deployment.

Relevant Error/Panic Output Snippet

╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to module.vault.vault_auth_backend.kubernetes,
│ provider "provider[\"registry.terraform.io/hashicorp/vault\"]" produced an
│ unexpected new value: Root resource was present, but now absent.
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.
╵

Terraform Configuration Files

Example 1:

resource "vault_auth_backend" "kubernetes" {
    path            = "myapp//kubernetes"
    type            = "kubernetes"
}

Example 2:

resource "vault_auth_backend" "kubernetes" {
    path            = "/kubernetes"
    type            = "kubernetes"
}

Steps to Reproduce

  1. Run terraform apply on a module containing either of the provided examples.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No

jtv8 avatar Sep 07 '23 15:09 jtv8