Comments (5)
Hi @dantheman999301, radom_string
uses crypto/rand
under the hood and rand.Reader
to give cryptographically secure strings and I'm not sure it will be possible to add a seed parameter.
from terraform-provider-random.
I'd like to be able to do this as well!
Basic use case:
I handle an application with multiple environments and tenants. so for each env/tenant combo, there are
- some shared resources (the same in all env/tenants)
- some environment resources (the same for all tenants in an environment)
- some tenant resources (unique per tenant)
To switch between them, I have an init script which reconfigures terraform for the target env/tenant combo, and imports any resources missing from the state.
Now, I have environment resources based on random_string
, e.g. database credentials for server instances shared within the environment. I can import the database server itself OK, but because the random_string
resources are different in the new env/tenant, terraform wants to destroy and recreate it with the new credentials (which will break the existing tenants in that environment). Ideally i'd like to seed the random_string resources based on the environment name, but that doesn't seem to be what keepers do (setting a keeper to the env name and reconfiguring yields different random_string results, even though the keeper value has not changed).
I could probably work around it with a random int, seeded with something derived from the environment name, then hash that int, but it would be much nicer to work with if I didn't have to.
Maybe random_string
can switch to a different RNG if a seed is provided? (If the user is providing a seed, cryptographic security is probably not a concern).
from terraform-provider-random.
Yes, I did notice that when I was having a poke around (but I don't know Go or it's libraries that well).
I ended up somewhat hacking around it using a random id and then converting that to hex so it was uri friendly which did the job but was not that nice.
I could even create a random int (with a seed), then hash it and then strip it to X characters but it just seems a bit of a hack. But if it can't be done, it can't be done!
from terraform-provider-random.
@tomasaschan Is it not possible to import the random_string
resource as well?
from terraform-provider-random.
@remilapeyre Maybe; I haven't been able to figure out how to export/import them. (The other resources I import based on their actual state in Azure, but the random_string
resources naturally don't exist there, and the properties they write to in the configuration are write-only.)
from terraform-provider-random.
Related Issues (20)
- Documentation: random_shuffle output is already list HOT 2
- random_pet generating non unique names
- Update Go Module to Go 1.20 Minimum HOT 1
- tyring to upgrade azurerm version but getting below error. HOT 3
- Ambiguous wording in docs on the parameters for RandomPassword, eg "numeric = true" can still generate a password without numerics.
- Resource 'snowflake_grant_privileges_to_role' marks 'priveleges' attribute as changed regardless of any changes being made HOT 2
- random_shuffle need to add position 0 of an array to return 1 single result string HOT 2
- Support UUIDv7
- Enable password cannot have more than 2 repeated characters
- Feature Request: random IP from CIDR range HOT 4
- Feature Request: Random Date HOT 2
- `random_bytes` resource does not explicitly mention being "sufficiently random for cryptographic use HOT 2
- `random_bytes` resource does not explicitly mention being "sufficiently random for cryptographic use" HOT 2
- Improve documentation HOT 2
- Adjust Go Module Address
- Panic on `random_string` when all properties set to `false` HOT 3
- After importing random_string, special flag is changed HOT 2
- Importing a random password using an import block outputs a sensitive value during apply. HOT 1
- `provider::random::string()` function HOT 2
- Add word/profanity filter for random_pet HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-provider-random.