https://pulumi.com logo
#general
Title
# general
c

cold-caravan-83486

02/10/2020, 1:46 PM
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

tall-librarian-49374

02/10/2020, 2:09 PM
You could use
Pulumi.Random.RandomId
or
RandomString
resources for that
c

cold-caravan-83486

02/10/2020, 2:25 PM
Thanks, that looks helpful!