-
Notifications
You must be signed in to change notification settings - Fork 16
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
Resource properties named id
are ignored
#171
Comments
I'm currently unable to reproduce this issue. I've recreated your program and it completes Here's a few next steps you could try to narrow down the issue:
|
Hi Bradley, Thanks for your reply, yes I was still running the preview. I tried the verbose earlier and it was still showing only the error without much context. Your third comment though, made me realize that it may not be the Azure resource id, but the id in the stack, which was the case. We're standardizing our resources' names with The same naming convention works fine for all the other resources, like the policy where I'm referencing the fragment: As a workaround, I think I could change the naming format for the policy fragment to not contain colon symbols while the resource doesn't support them, and then use an alias later once the naming format is accepted. |
Thanks for the speedy reply @leinyl I'm not quite sure if I follow what exactly you mean by "the id in the stack". Do you still consider this a use-case which should work correctly in Azure and therefore needs addressing in the provider? If so could you provide a repro which demonstrates the id in the stack being incorrect. Thanks! |
I'm referring to the name property in the resource. I originally thought it was the Id in the arguments as the other resources accept the naming format we have been using, and the error message was pointing an id property.
I changed it to only dashes for the time being |
Well the issue seems to be that the resource is ignoring the Id property in PolicyFragmentArgs, it's just using the name parameter in the PolicyFragment regardless of the Id value in the arguments. |
Ok, I can now reproduce the error with the following program: using Pulumi;
using Pulumi.AzureNative.ApiManagement;
return await Deployment.RunAsync(() =>
{
_ = new PolicyFragment(
$"apim-policy-fragment:grm-sp-backend-routing:ApimServiceName",
new PolicyFragmentArgs
{
Id = "grm-sp-backend-routing",
Description = "A policy fragment example",
Format = PolicyFragmentContentFormat.Rawxml,
ResourceGroupName = "rg1",
ServiceName = "apimService1",
Value = "<fragment><json-to-xml apply=\"always\" consider-accept-header=\"false\" /></fragment>",
});
}); From the verbose log I can see that the
This is due to this line in the Pulumi Dotnet SDK: return SerializeFilteredPropertiesAsync(
label, args,
key => key != Constants.IdPropertyName && key != Constants.UrnPropertyName,
keepResources, keepOutputValues: keepOutputValues); I don't think the exclusion of entries named var dictionary = await args.ToDictionaryAsync().ConfigureAwait(false);
var (serializedProps, propertyToDirectDependencies) =
await SerializeResourcePropertiesAsync(
label,
dictionary,
await this.MonitorSupportsResourceReferences().ConfigureAwait(false),
keepOutputValues: remote && await MonitorSupportsOutputValues().ConfigureAwait(false)).ConfigureAwait(false); I'm going to transfer this over to the dotnet project for them to check my analysis and put in their planning. |
id
are ignored
Opened an issue on pulumi/pulumi pulumi/pulumi#13781 to discuss the implications of this since it is not only a dotnet SDK problem |
What happened?
Regardless of the id format, and even though it matches the regular expression on the error, the resource creation always returns the following error.
The error showed initially using v1.104.0 of the Pulumi.AzureNative library. Upgrading the library to v2.3.0 did not resolve the error.
Expected Behavior
The PolicyFragment resource is created.
Steps to reproduce
Create a PolicyFragment resource using C# as explained in the documentation here:
https://www.pulumi.com/registry/packages/azure-native/api-docs/apimanagement/policyfragment/#azure-native-apimanagement-policyfragment
Not even the provided sample passes the id validation:
Output of
pulumi about
CLI
Version 3.78.1
Go Version go1.20.7
Go Compiler gc
Plugins
NAME VERSION
dotnet unknown
Host
OS Microsoft Windows 10 Enterprise
Version 10.0.19044 Build 19044
Arch x86_64
This project is written in dotnet: executable='C:\Program Files\dotnet\dotnet.exe' version='7.0.304'
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).
The text was updated successfully, but these errors were encountered: