puppetlabs / puppetlabs-azure_arm

The Puppet Azure ARM Module
Apache License 2.0
4 stars 15 forks source link

azure_sql_server returns as succeeded even though no server gets created #20

Open Monual opened 5 years ago

Monual commented 5 years ago

When creating a new azure_sql_server, we get a response code of 202, which Puppet equates to "succeeded":

Info: Entered create for resource new_sql_server of type Server
Info: Calling operation Servers_CreateOrUpdate
Info: Getting oauth2 token
Debug: get oauth2 token response code is 200 and body is {<redacted>}
Info: Authentication succeeded
Debug: URI is (Put) https://management.azure.com/subscriptions/<redacted>/resourceGroups/rdl_test/providers/Microsoft.Sql/servers/new_sql_server?api-version=2015-05-01-preview, body is {"location"=>"eastus2", "name"=>"new_sql_server", "properties"=>{"administratorLogin"=>"my-admin", "version"=>12.0}}, query params are {"api-version"=>"2015-05-01-preview"}, headers are {"User-Agent"=>"puppetlabs-azure_arm/0.2.1", "Content-Type"=>"application/json", "Authorization"=>"<redacted>"}
Debug: response code is 202 and body is {"operation":"UpsertLogicalServer","startTime":"2019-05-09T18:45:43.28Z"}

However, according to the API, error code 202 only means that the job to create a SQL server has been submitted. The actual result of the deployment can be found by looking at the Activity Log in the Azure Portal and seeing this:

"statusMessage": "{status:Failed,error: {code:ResourceOperationFailure, 
message: The resource operation completed with terminal provisioning state `Failed`., 
details: code:RegionDoesNotSupportVersion, 
message: Location 'East US 2' is not accepting creation of new Azure SQL Database Servers of 
         version '12' at this time. This location only supports the following server versions: '12.0'. 
         Please retry using a supported server version. }]}}"

This is easily corrected, of course. But it would be nice if rather than assume that a deploy job succeeded, azure_arm would wait for a response code from the job run to ensure whether the deployment actually worked.

tamilsaran commented 4 years ago

I want azure mysql service creation and I am using azure_arm module in puppet forge I just refer this file in inside of module azure_dbformysql_server.md and then i am facing that issue Error: This Block Expression has no effect. A value was produced and then forgotten (one or more preceding expressions may have the wrong form) (file: /etc/puppetlabs/code/environments/production/modules/azure_arm/examples/azmysql.pp, line: 5, column: 1) Error: This expression is invalid. Did you try declaring a 'azure_database' resource without a title? (file: /etc/puppetlabs/code/environments/production/modules/azure_arm/examples/azmysql.pp, line: 5, column: 1) Error: This expression is invalid. Did you try declaring a 'azure_firewall_rule' resource without a title? (file: /etc/puppetlabs/code/environments/production/modules/azure_arm/examples/azmysql.pp, line: 22, column: 1) Error: This expression is invalid. Did you try declaring a 'azure_server' resource without a title? (file: /etc/puppetlabs/code/environments/production/modules/azure_arm/examples/azmysql.pp, line: 32, column: 1) Error: Language validation logged 4 errors. Giving up