It’s weird that I can store state using something ...
# aws
It’s weird that I can store state using something like
Copy code
random.RandomPet("SamplePetz", {..})
But can’t set my own config from runtime.
What are you trying to do?
Say I want to store a value set from env variables. Like, who submitted a PR.
Yes - this is a scenario that's come up a few times. There's no first-class support for it today. But it's possible to accomplish with a simple dynamic provider. There are theoretically three places we could store this long-term: 1. As a resource in the resource state 2. As metadata in the deployment 3. As config Config is the least likely solution, as it is not versioned with the state directly - it is provided separately at deployment time. Resource state is simple and can be done with a dynamic provider today in a few lines of code. But it would be nice to have something built in which just stores some state (like
new pulumi.Variable()
?). A really first-class version of this might be possible by allowing user code to set values for custom metadata. We already store a bit of metadata in the state file, but it would be possible to expose read existing metadata and write new custom metadata. We'd have to be a little careful here, as the CRUD model for this is not as well-defined as the resource model CRUD is.
❤️ 1
@white-balloon-205 I really appreciate the input and taking a look, thank you so much for the help here!
Out of curiosity, wouldn’t versioning the config with the state be a better approach as you want to match the config at that deployment time? It gives you history? Right now our configs come from env variables from CI and that’s not versioned. But our code is, the ability to add config at runtime with code that’s versioned is neater in my opinion.