pulumi / pulumi-azure-native

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

Deletion of DNS zone fails #969

Closed lkt82 closed 2 years ago

lkt82 commented 3 years ago

When deleting a Azure DNS zone, the deletion fails with this error

error: Error occurred unmarshalling JSON - Error = 'json: cannot unmarshal bool into Go value of type map[string]interface {}' JSON = 'true'

Steps to reproduce

  1. Create a "Pulumi.AzureNative.Network.Zone" resource
  2. Create a few "Pulumi.AzureNative.Network.RecordSet" resources for the zone
  3. Destroy the stack

Expected: The zone to be deleted Actual: Deletion fails

Note If you run a second destroy after the failed destroy it succeeds.

Context Language: C# Provider version: 1.15.0 Pulumi version: 3.6.0

mikhailshilkov commented 3 years ago

Hi @lkt82 thank you for reporting this.

Do you have a simple snippet for me to reproduce this problem?

lkt82 commented 3 years ago

@mikhailshilkov

Yes I do.

using System.Threading.Tasks;
using Pulumi;
using Pulumi.AzureNative.Network;
using Pulumi.AzureNative.Network.Inputs;
using Pulumi.AzureNative.Resources;
using Deployment = Pulumi.Deployment;

namespace TrafficPlatform
{
    public class TrafficPlatformStack : Stack
    {
        public static async Task Main() => await Deployment.RunAsync<TrafficPlatformStack>();

        private Zone _zone = null!;
        private ResourceGroup _resourceGroup;

        public TrafficPlatformStack()
        {
            _resourceGroup = new ResourceGroup("rg", new ResourceGroupArgs
            {
            });

            CreateZone();

            CreateRecords();
        }

        private void CreateZone()
        {
            _zone = new Zone("dnsz", new ZoneArgs
            {
                ResourceGroupName = _resourceGroup.Name,
                Location = "global",
                ZoneType = ZoneType.Public,
                ZoneName = "pulumitestcase.com"
            }, new()
            {
                DeleteBeforeReplace = true
            });
        }

        private void CreateRecords()
        {
            Cname("test1", "test1", 1);
            Cname("test2", "test2", 1);
            Cname("test3", "test3", 1);
        }

        private RecordSet Cname(string name, string alias, double ttl)
        {
            var api = new RecordSet(name, new RecordSetArgs
            {
                ResourceGroupName = _resourceGroup.Name,
                ZoneName = _zone.Name,
                RelativeRecordSetName = name,
                Ttl = ttl,
                RecordType = "CNAME",
                CnameRecord = new CnameRecordArgs
                {
                    Cname = alias
                }
            }, new()
            {
                DeleteBeforeReplace = true
            });

            return api;
        }
    }
}
lkt82 commented 3 years ago

hi @mikhailshilkov was the snippet useful :)?

JoeDo commented 3 years ago

I just experienced the same error message using an Azure Native TypeScript project and Pulumi v3.13.2. Running "destroy" a second time caused the deletion to succeed.

lkt82 commented 2 years ago

@mikhailshilkov Any news on this issue?. You still can't delete a DNS zone

JoeDo commented 2 years ago

@mikhailshilkov, @lkt82 Same. Still present in 3.16.0.

mikhailshilkov commented 2 years ago

Could someone run the deletion with debug flags and share the result with me at mikhail@pulumi.com?

pulumi destroy --skip-preview --yes --debug -v=9 --logflow --logtostderr
lkt82 commented 2 years ago

Dropped you a mail