pulumi / pulumi-azure-native

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

Nonspecific error: `ResourceCreationValidateFailed` #3262

Open MitchellGerdisch opened 4 months ago

MitchellGerdisch commented 4 months ago

Hello!

Issue details

Using the following code which has a rather subtle error for the Domain resource:

    const baseName = "pulumi"
    const resourceGroup = new azure_native.resources.ResourceGroup(`${baseName}-rg`)
    // Create an Azure Communication Services Email Service
    const emailService = new azure_native.communication.EmailService(`${baseName}-ems`, {
        resourceGroupName: resourceGroup.name,
        location: "Global",
        dataLocation: "United States",
    });

    // Create an Email Domain associated with the Email Service
    const emailDomain = new azure_native.communication.Domain(`${baseName}-dom`, {
        domainManagement: "AzureManagedDomain", // This is THE INCORRECT STRING VALUE
        emailServiceName: emailService.name, 
        location: "global",
        resourceGroupName: resourceGroup.name,
    });

One gets the following error: error: Code="ResourceCreationValidateFailed" Message="The resource validation failed."

The cause of the error is that the domainManagement field should be set to the string AzureManaged or use the enumeration that is available. It took a bit of effort to figure this out and it would be a much better experience if the error included a reference to what is causing the validation to fail.

Affected area/feature

danielrbradley commented 4 months ago

Unfortunately, this validation and these errors are provided by the Azure API – we just pass on any error message as error output. This most likely needs addressing by Azure, then will be automatically surfaced by this provider.