after using terraform move -state-out aws_secretsmanager_secret_version.superuser, when run plan terraform want recreate it

40 views Asked by At

I have run:

terraform state mv -state-out="path" module.rds.aws_secretsmanager_secret_version.superuser module.rds.aws_secretsmanager_secret_version.superuser

from my new terraform config I run terraform plan and the result is the following.

# module.rds.aws_secretsmanager_secret_version.superuser must be replaced
-/+ resource "aws_secretsmanager_secret_version" "superuser" {
      ~ arn            = "arn:aws:secretsmanager:eu-west-2:**********:secret:rds-superuser-TJ*******-M****B" -> (known after apply)
      ~ id             = "arn:aws:secretsmanager:eu-west-2:**********:secret:rds-superuser-TJ*******-M****|terraform-202000000000070000001d" -> (known after apply)
      ~ secret_string  = (sensitive value) # forces replacement
      ~ version_id     = "terraform-202400000000001d" -> (known after apply)
      ~ version_stages = [
          - "AWSCURRENT",
        ] -> (known after apply)
        # (1 unchanged attribute hidden)
    }

what I did wrong.

I have tried to use terraform import:

terraform import aws_secretsmanager_secret_version.superuser 'arn:aws:secretsmanager:eu-west-2:::::::secret:rds-superuser-T:::::::::B|terraform-202400000000001d

the same result

AS

terraform import aws_secretsmanager_secret_version.superuser 'arn:aws:secretsmanager:eu-west-2:::::::secret:rds-superuser-T:::::::::B|"AWSCURRENT" 

does not work:

Error: reading Secrets Manager Secret Version (arn:aws:secretsmanager:eu-west-2::::::secret:rds-superuser-T::::B|AWSCURRENT): operation error Secrets Manager: GetSecretValue, https response error StatusCode: 400, RequestID: 13cf60fc-482a-438a-a22c-4265c56b07cd, api error ValidationException: 1 validation error detected: Value 'AWSCURRENT' at 'versionId' failed to satisfy constraint: Member must have length greater than or equal to 32
0

There are 0 answers