Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

random_string could support import #62

Closed
jaysonsantos opened this issue Jun 11, 2019 · 10 comments
Closed

random_string could support import #62

jaysonsantos opened this issue Jun 11, 2019 · 10 comments

Comments

@jaysonsantos
Copy link

Terraform Version

Terraform v0.12.1

Affected Resource(s)

  • random_string

Terraform Configuration Files

resource "random_string" "master_password" {
  length = 16
}

resource "aws_rds_cluster" "cluster" {
  master_password = random_string.master_password.result
}

Expected Behavior

It would be nice to be able to import random strings when you already have things like an RDS cluster set-up otherwise you need to change the password after the first import happens (if you want to keep the password on the state to be able to rotate).

Actual Behavior

Import is denied

Steps to Reproduce

  1. terraform random_string.master_password 1234

If you think this would be useful, let me know and I can try to implement it.

@jaysonsantos jaysonsantos changed the title random_string could support import for initial seed random_string could support import Jun 11, 2019
@dijitali
Copy link

Agreed. A lot of modules in the community make use of the random_string to ensure naming uniqueness. As a result the resources in the modules depending on the random_string must be recreated on state import, which is a pain!

@crisp2u
Copy link

crisp2u commented Jul 9, 2019

It seems there was an attempt: #46 I still think it would be usefull

@dekimsey
Copy link

dekimsey commented Jan 3, 2020

This would be amazing but also for the random_password resource. We need to migrate some uses of random_string to random_password but I'm wary of doing that since it'll regenerate the values.

@nijave
Copy link

nijave commented Jan 6, 2020

You can achieve this by pulling down the state, manually editing, and pushing back up although importing would be ideal

@thibault-lepeu
Copy link

thibault-lepeu commented Jan 21, 2020

I actually this exact problem today, I really can't shutdown my production servers because of this.

terraform import random_string.user XXX
random_string.user: Importing from ID "XXX"...

Error: resource random_string doesn't support import

This would be super welcome 👍

@jahantech
Copy link
Contributor

jahantech commented Mar 2, 2020

Is this solution acceptable? #100
Any comments will be appreciated.

@gespinoza22
Copy link

Concur on support for import on random_string and random random_password

@Sytten
Copy link

Sytten commented May 20, 2020

Can this provider be released so we have access to this feature. Thanks.

@skolsuper
Copy link

skolsuper commented Sep 2, 2020

Seems like this was released and works nicely, thanks! Can close this issue now 👍

edit: spoke too soon, I had to manually edit the state to prevent terraform from recreating it on the first apply:

# random_password.secret_key_base must be replaced
-/+ resource "random_password" "secret_key_base" {
      ~ id               = "none" -> (known after apply)
      + length           = 64 # forces replacement
      + lower            = false # forces replacement
      + min_lower        = 0 # forces replacement
      + min_numeric      = 0 # forces replacement
      + min_special      = 0 # forces replacement
      + min_upper        = 0 # forces replacement
      + number           = true # forces replacement
      + override_special = "abcdef" # forces replacement
      ~ result           = (sensitive value)
      + special          = true # forces replacement
      + upper            = false # forces replacement
    }

all values such as length, lower etc were all null in the state after import

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests