Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pulumi.AzureNative.AppConfiguration.KeyValue failing to create #3208

Open
holtsoftware opened this issue Apr 10, 2024 · 2 comments
Open

Pulumi.AzureNative.AppConfiguration.KeyValue failing to create #3208

holtsoftware opened this issue Apr 10, 2024 · 2 comments
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec upstream/service

Comments

@holtsoftware
Copy link

holtsoftware commented Apr 10, 2024

What happened?

When i go to create a KeyValue object using AzureNative in C# it will not add the KeyValue to the Azure App configuration instead it errors out with a very generic error error: autorest/azure: error response cannot be parsed: {"" '\x00' '\x00'} error: EOF I can provide the same information to AzureClassic and it will create the Key in Azure App Configuration without issue.

Example

new Pulumi.AzureNative.AppConfiguration.KeyValue($"global-{global.Key}", new()
{
    ConfigStoreName = "<The real name of the Config Store>",
    ResourceGroupName = "<The real name of the config store's resource group>",
    KeyValueName = "RootUris:Category:Endpoint$dev/Global",
    Value = "https://someurl.com/",
});

when I look at the details of the up it looks like this

+ azure-native:appconfiguration:KeyValue: (create)
        [urn=urn:pulumi:dev::...::azure-native:appconfiguration:KeyValue::global-RootUris__Category__Endpoint]
        [provider=urn:pulumi:dev::...::pulumi:providers:azure-native::default_2_36_0::b49d6206-cd02-42d0-828f-be0d0ae7354f]
        configStoreName  : ""
        keyValueName     : "RootUris:Category:Endpoint$dev/Global"
        resourceGroupName: ""
        value            : "https://someurl.com/"

After I tell it to up I get this error back
error: autorest/azure: error response cannot be parsed: {"" '\x00' '\x00'} error: EOF

Output of pulumi about

CLI
Version 3.112.0
Go Version go1.22.1
Go Compiler gc

Plugins
NAME VERSION
dotnet unknown

Host
OS Microsoft Windows 11 Enterprise
Version 10.0.22631 Build 22631
Arch x86_64

This project is written in dotnet: executable='C:\Program Files\dotnet\dotnet.exe' version='8.0.202'

Current Stack: organization/*/dev

TYPE URN
pulumi:pulumi:Stack urn:pulumi:dev::...::pulumi:pulumi:Stack::...-dev
pulumi:providers:azure-native urn:pulumi:dev::...::pulumi:providers:azure-native::default_2_36_0

Found no pending operations associated with dev

Backend
Name aholt-LT
URL azblob://.../Azure/Infrastructure/AppConfiguration?storage_account=...appsdevopssa
User ...\aholt
Organizations
Token type personal

Pulumi locates its logs in C:\Users\aholt\AppData\Local\Temp by default
warning: Failed to get information about the Pulumi program's dependencies: Could not get dependencies because pulumi specifies a binary

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).

@holtsoftware holtsoftware added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Apr 10, 2024
@thomas11
Copy link
Contributor

Thank you for reporting this, @holtsoftware. I can reproduce with this complete program:

using Pulumi.AzureNative.AppConfiguration;
using Pulumi.AzureNative.AppConfiguration.Inputs;
using Pulumi.AzureNative.Resources;
using System.Collections.Generic;

return await Pulumi.Deployment.RunAsync(() =>
{
    var resourceGroup = new ResourceGroup("resourceGroup");

    var configStore = new ConfigurationStore("configStore", new() {
        ResourceGroupName = resourceGroup.Name,
        Sku = new SkuArgs() { Name = "Standard" }
    });

    var kv = new KeyValue("kv", new()
    {
        ConfigStoreName = configStore.Name,
        ResourceGroupName = resourceGroup.Name,
        KeyValueName = "RootUris:Category:Endpoint$dev/Global",
        Value = "https://someurl.com/",
    });

    // Export the primary key of the Storage Account
    return new Dictionary<string, object?>
    {
        ["kv"] = kv
    };
});

We'll look into it soon.

@thomas11
Copy link
Contributor

It's the / in the key-value name that trips up the Azure endpoint and makes it respond, confusingly, with 404. The exact same program just with the slash removed works for me.

I verified that we do URL-escape the value, so that's not the problem.

Unfortunately, it seems to be a known issue but users are simply directed to use the data plane SDK instead. That's what Terraform does, too. It's not an option for Pulumi, however, since our SDK is generated from the ARM (control plane) spec.

I think your options at this point are

  1. change your naming convention to avoid slashes, or
  2. use the AppConfiguration data plane SDK in your program to create the key-value, but it won't be managed by Pulumi then.

@thomas11 thomas11 added upstream/service and removed needs-triage Needs attention from the triage team labels Apr 11, 2024
thomas11 added a commit that referenced this issue Apr 11, 2024
In #3208 we see a case where an Azure API responds with a non-JSON body
in an error case. We don't expect that and run
`autorest.ByUnmarshallingJSON`, causing a confusing deserialization
error:
```
error: autorest/azure: error response cannot be parsed: {"" '\x00' '\x00'} error: EOF
```

After this change, the same program errors with
```
error: unexpected response from the service: '', HTTP status 404 Not Found
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec upstream/service
Projects
None yet
Development

No branches or pull requests

2 participants