CompositionalIT / farmer

Repeatable Azure deployments with ARM templates - made easy!
https://compositionalit.github.io/farmer
MIT License
514 stars 156 forks source link

PostgreSQL dependency generates incorrect path #1120

Closed isaacabraham closed 5 days ago

isaacabraham commented 6 days ago

Given this code:

let pgServer =
    postgreSQL {
        name "pgserver"
        add_database "foo"
        admin_username "theadmin"
    }

let app =
    webApp {
        name "mywebapp"
        depends_on pgServer
    }

The following ARM is generated:

"apiVersion": "2021-03-01",
"dependsOn": [
    "[resourceId('Microsoft.DBforPostgreSQL/servers/databases', 'pgserver')]",
],
"kind": "app",
"location": "westeurope",
"name": "mywebapp",

The offending line

"[resourceId('Microsoft.DBforPostgreSQL/servers/databases', 'pgserver')]",

fails: the type 'Microsoft.DBforPostgreSQL/servers/databases' requires '2' resource name argument(s) which makes sense - you need to either supply the DB name as well as the server, OR change the resource Id to just the server (remove the /databases bit.