pulumi / pulumi-azure-native

Azure Native Provider
Apache License 2.0
126 stars 34 forks source link

PrivateEndpointConnection returns BadRequest #867

Open pierskarsenbarg opened 3 years ago

pierskarsenbarg commented 3 years ago

Expected behavior

A PrivateConnectionEndpoint resource should be created

Current behavior

Error message I'm getting is:

error: autorest/azure: error response cannot be parsed: "" error: EOF

which doesn't really help to solve the issue either.

Steps to reproduce

Code for connection:

const privateConnection = new azure.dbformysql.PrivateEndpointConnection(`${name}-privateConnection`, {
            resourceGroupName: resourceGroupName,
            serverName: server.name,
        });

Server is already created as is the resource group.

I have also tried filling out the rest of the properties, but those two are the only required ones

mikhailshilkov commented 3 years ago

Hey @pierskarsenbarg thank you for reporting this. Could you log and attach the HTTP logs?

mikhailshilkov commented 3 years ago

Oh, I actually think this is https://github.com/pulumi/pulumi-azure-native/issues/808#issuecomment-831182398

Do you have an ARM template that works for this? I have hard time believing that this resource may work with just these two fields.

pierskarsenbarg commented 3 years ago

Logs: out.txt

I'll build a resource in the portal and grab the arm template for that

pierskarsenbarg commented 3 years ago

ARM template (which I've literally just pasted in here - I'm about to look at it now) arm.txt

mikhailshilkov commented 3 years ago

Thank you. The relevant bits:

PUT /subscriptions/32b9cb2e-69be-4040-80a6-02cd6b2cc5ec/resourceGroups/pulumi-selfhosted-pk847634fc/providers/Microsoft.DBforMySQL/servers/pulumi-selfhosted-pk-dbservercd29be8d/privateEndpointConnections/pulumi-selfhosted-pk-privateConnection?api-version=2018-06-01 HTTP/1.1
Host: management.azure.com
{"properties":{"privateLinkServiceConnectionState":{"description":"Approved","status":"Approved"}}}

HTTP/1.1 204 No Content
Content-Length: 0
pierskarsenbarg commented 3 years ago

So I added in a couple of the inputs to try that

rockebee commented 2 years ago

Hi @pierskarsenbarg, @mikhailshilkov, I'm actually running into the same issue as described above and do retrieve the error: resource partially created but read failed autorest/azure: error response cannot be parsed: "" error: EOF error message when attempting to create a privateEndpointConnection for azure-native.dbformysql server

Full related messages (retrieved from a pulumi up -f --debug -v=4 --logtostderr:

I0603 00:51:27.773325  406489 eventsink.go:59] Registering resource: t=azure-native:dbformysql:PrivateEndpointConnection, name=hc-sandbox-sts-MysqlPec, custom=true, remote=false
[...]
I0603 00:51:34.455346  406489 eventsink.go:59] RegisterResource RPC prepared: t=azure-native:dbformysql:PrivateEndpointConnection, name=hc-sandbox-sts-MysqlPec
[...]
I0603 00:51:34.528686  406489 step_executor.go:364] StepExecutor worker(62): applying step create on urn:pulumi:hc-dev-sts::pulumi.solution.hc-dev::azure-native:dbformysql:PrivateEndpointConnection::hc-sandbox-sts-MysqlPec (preview false)
I0603 00:51:35.574810  406489 step_executor.go:364] StepExecutor worker(62): step create on urn:pulumi:hc-dev-sts::pulumi.solution.hc-dev::azure-native:dbformysql:PrivateEndpointConnection::hc-sandbox-sts-MysqlPec failed with an error: resource partially created but read failed autorest/azure: error response cannot be parsed: "" error: EOF: autorest/azure: error response cannot be parsed: "" error: EOF
I0603 00:51:35.575006  406489 step_executor.go:364] StepExecutor worker(62): step create on urn:pulumi:hc-dev-sts::pulumi.solution.hc-dev::azure-native:dbformysql:PrivateEndpointConnection::hc-sandbox-sts-MysqlPec failed, signalling cancellation
I0603 00:51:35.575145  406489 deployment_executor.go:293] deploymentExecutor.Execute(...): context finished: context canceled

I was trying to understand the original issue on what may be missing and understand that this is likely caused by an unexpected 204 response, however in my logs I was not able to find the respective HTTP request at all.

My pulumi code (excerpt):

// create Azure Database for MySQL binding
const mysqlServer = new azure_native.dbformysql.Server(`${clusterName}-mysqlServer`, {
    location: rg.location,
    properties: { ... },
    resourceGroupName: rg.name,
    serverName: "hc-database-svc01",
}

const privateEndpointConnection = new azure_native.dbformysql.PrivateEndpointConnection(`${clusterName}-MysqlPec`, {
    privateEndpointConnectionName: "hc-database-pec",
    privateLinkServiceConnectionState: {
        description: "Approved by sts",
        status: "Approved",
    },
    resourceGroupName: rg.name,
    serverName: "hc-database-svc01",
}, { dependsOn: mysqlServer });

@pierskarsenbarg: Have you ever found a working solution for your case? (not sure what was meant with "added in a couple of the inputs to try that" in latest comment ...) @mikhailshilkov: Any idea on what could be tried to fix or workaround this?