farmer icon indicating copy to clipboard operation
farmer copied to clipboard

PostgreSQL dependency generates incorrect path

Open isaacabraham opened this issue 1 week ago • 0 comments

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.

isaacabraham avatar Jul 02 '24 18:07 isaacabraham