pulumi / pulumi-azure

A Microsoft Azure Pulumi resource package, providing multi-language access to Azure
Apache License 2.0
132 stars 50 forks source link

azure eventgrid: Adding subscriptions does not work #1237

Open chriscogburn opened 3 years ago

chriscogburn commented 3 years ago

There are several errors in this example:

Once you clear all that up, it fails with the following error: error: Error creating/updating EventGrid System Topic Event Subscription "exampleSub2eeb002" (System Topic "subTopic"): eventgrid.SystemTopicEventSubscriptionsClient#CreateOrUpdate: Failure sending request: StatusCode=404 -- Original Error: Code="ParentResourceNotFound" Message="Can not perform requested operation on nested resource. Parent resource 'subTopic' not found."

I tried adding DependsOn to everything, still it fails.

File: themes/default/content/docs/reference/pkg/azure/eventgrid/systemtopiceventsubscription.md

leezen commented 3 years ago

@chriscogburn Could you please provide the code you're trying to use that's failing? I don't see subTopic anywhere in the example, so it'd be helpful to see the complete code you're trying to use.

chriscogburn commented 3 years ago

I had to modify all the names of the example code or it wouldn't run due to the length of the names being exceeded. Here is what I ended up with.

        var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
        {
            Location = "West Europe",
        });
        var exampleAccount = new Azure.Storage.Account("exampleaccount", new Azure.Storage.AccountArgs
        {
            ResourceGroupName = exampleResourceGroup.Name,
            Location = exampleResourceGroup.Location,
            AccountTier = "Standard",
            AccountReplicationType = "LRS",
            Tags = 
            {
                { "environment", "staging" },
            },
        });
        var exampleQueue = new Azure.Storage.Queue("exampleQueue", new Azure.Storage.QueueArgs
        {
            StorageAccountName = exampleAccount.Name,
        });
        var exampleSystemTopic = new Azure.EventGrid.SystemTopic("exampleTopic", new Azure.EventGrid.SystemTopicArgs
        {
            Location = "Global",
            ResourceGroupName = exampleResourceGroup.Name,
            SourceArmResourceId = exampleResourceGroup.Id,
            TopicType = "Microsoft.Resources.ResourceGroups",
        });
        var exampleSystemTopicEventSubscription = new Azure.EventGrid.SystemTopicEventSubscription("exampleSub", new Azure.EventGrid.SystemTopicEventSubscriptionArgs
        {
            SystemTopic = "subTopic",
            ResourceGroupName = exampleResourceGroup.Name,
            StorageQueueEndpoint = new Azure.EventGrid.Inputs.SystemTopicEventSubscriptionStorageQueueEndpointArgs
            {
                StorageAccountId = exampleAccount.Id,
                QueueName = exampleQueue.Name,
            },
        });