Is there a way to create an object that only exist...
# general
c
Is there a way to create an object that only exists to get a name with a suffix (to break circular dependencies)? If you want to make a storage container that's only accessible from a web app that knows the name of that storage container, then you need to make the container with a CORS rule that knows the URL of the web app, but the web app needs to know the deployed name of the container. If you can create a placeholder resource that gets the suffix added to its ID, then the web app can be given the ID, and the container can then be created with that name and a CORS rule with the URL of the web app. like:
Copy code
let containerIdHolder = CustomResource("justAName", "mycontainer", ResourceArgs.Empty)
...
let envVars = Inputs.ServiceTemplateSpecContainersEnvsArgs(Name = "containerName", Value = containerIdHolder.Id)
...
let webApp = WebApp (envVars = ["containerName", containerIdHolder.Id)]) 
...
let actualContainer = Container (Name = containerIdHolder.Id, CorsRules = (Origins = [webApp.url]))
Is that possible?
t
You could use
Pulumi.Random.RandomId
or
RandomString
resources for that
c
Thanks, that looks helpful!