Keeper-Security / terraform-provider-secretsmanager

MIT License
8 stars 4 forks source link

Updating folder UID not allowed #34

Open Learloj opened 3 months ago

Learloj commented 3 months ago

Since it is allowed to work with subfolders as addressed in #17 we want to move our secrets to a subfolder. When we update this in Terraform (setting the folder_uid to another value), the plan looks good, but the apply fails:

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # secretsmanager_login.basrtest will be updated in-place
  ~ resource "secretsmanager_login" "basrtest" {
      ~ folder_uid = "<old UID>" -> "<new UID>"
        id         = "<record ID>"
        # (4 unchanged attributes hidden)

        # (2 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
secretsmanager_login.basrtest: Modifying... [id=<record ID>]
╷
│ Error: changes to folder_uid, uid, and type are not allowed
│
│   with secretsmanager_login.basrtest,
│   on main.tf line 18, in resource "secretsmanager_login" "basrtest":
│   18: resource "secretsmanager_login" "basrtest" {

When I execute the plan and apply with -replace=<resource it works fine, and the resource is removed from the old folder and recreated in the new folder.

I think this provider should automatically recreate the resource when the folder_uid is updated.

idimov-keeper commented 3 months ago

This will be addressed in the next release - the only limitation is that both old/new folders must exist for the record to move between them. We will also add some new folder management resources.