pulumi / pulumi-azure-native

Azure Native Provider
Apache License 2.0
123 stars 32 forks source link

`cdn.Rule` throws "resource not found" #1701

Open jaxxstorm opened 2 years ago

jaxxstorm commented 2 years ago

What happened?

Trying to provision an azure CDN with a rule. I get an obscure error:

 error: Code="NotFound" Message="The resource cannot be found."

Similar to this https://github.com/pulumi/pulumi-azure-native/issues/1698

Steps to reproduce

Provision an azure CDN rule like so:

import * as pulumi from "@pulumi/pulumi";
import * as resources from "@pulumi/azure-native/resources";
import * as cdn from "@pulumi/azure-native/cdn";
import * as azure from "@pulumi/azure-native";

// Create an Azure Resource Group
const resourceGroup = new resources.ResourceGroup("resourceGroup");

const profile = new cdn.Profile("profile", {
    location: "WestUS",
    profileName: "profile",
    resourceGroupName: resourceGroup.name,
    sku: {
        name: "Standard_Verizon",
    },
});

const rewriteRule = new cdn.Rule('rewriteRule', {
    ruleSetName: 'MyAppRuleSet',
    ruleName: 'test',
    order: 1,
    profileName: profile.name,
    resourceGroupName: resourceGroup.name,
    actions: [ {
        name: "UrlRewrite",
        parameters: {
          destination: '/index.html',
          preserveUnmatchedPath: false,
          sourcePattern: '/',
          odataType: '#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlRewriteActionParameters',
        },
      },
    ],
    conditions: [
      {
        name: 'UrlFileExtension',
        parameters: {
          matchValues: ['0'],
          operator: cdn.Operator.GreaterThan,
          negateCondition: true,
          odataType: '#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlFileExtensionMatchConditionParameters',
        },
      },
    ],
  });

Expected Behavior

It works

Actual Behavior

It throws:

 error: Code="NotFound" Message="The resource cannot be found."

Versions used

No response

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

mnlumi commented 1 year ago

This issue still occurs in v1.103.0.

In v2.0.0-beta.1, the error is error: Code="InvalidResource" Message="Invalid @odata.type property value."