Create a WebApp in an existing ServicePlan
See original GitHub issueHi I’ve been playing around with trying to create a webApp
in an existing ASP. The ASP will be shared and configured manually so I don’t want the ARM template I generate to modify it or try to deploy it in any way.
Is there a good way to do this? If not, have there been discussions thoughts on how this might be possible and would it be something you would be interested in including? (I may, depending on work schedule, and subject to an acceptable design be able to contribute if so)
I have been playing around and the following script produces something very close to what I want.
let webAppName :string = ...
let aspName :string = ...
let sharedServicePlan =
sprintf "[concat(resourceGroup().id,'/providers/Microsoft.Web/serverfarms/%s')]" aspName
|> ResourceName
|> External
let webApp = webApp {
name "codat-my-web-app"
service_plan_name sharedServicePlan
app_insights_off
}
let deployment = arm{
location Location.UKSouth
add_resource webApp
}
However, this outputs an ARM template with an unmet dependency which causes
InvalidTemplate - Long running operation failed with status 'Failed'. Additional Info:'Deployment template validation
failed: 'The resource 'Microsoft.Web/serverfarms/...' is not defined in the template.
If, however, I remove the single entry in the dependsOn
array, it does exactly what I want.
"dependsOn": [
- "[concat(resourceGroup().id,'/providers/Microsoft.Web/serverfarms/...')]"
],
Obviously having to include an ARM expression is sub par and it would be good to make this something similar to the following
let sharedServicePlan : ResourceName = ExternalResource.ServicePlan ResourceGroup.Current aspName
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (16 by maintainers)
Top GitHub Comments
@TheRSP Apologies, just saw this. I’ll push out a release today.
@rjwpope Great. I have a pull request ready to go and have applied the same changes across other “linkable” resources. In the end I indeed redesigned the types so we effectively have four cases: