pulumi-azuread icon indicating copy to clipboard operation
pulumi-azuread copied to clipboard

metadataHost is mandatory

Open sam-cogan opened this issue 2 years ago • 3 comments

What happened?

The provider seems to have set the metadataHost variable to be mandatory, this seems odd given that it is not mandatory on the Terraform provider this is based on, and most users will not want to change from the detault.

Expected Behavior

Take a default value as with the Terraform provider

Steps to reproduce

Attempt to use the Azure AD Provider without specifying the MetaDataHost value.

Output of pulumi about

.

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

sam-cogan avatar Apr 27 '23 16:04 sam-cogan

@sam-cogan Thanks for reporting this discrepancy.

It looks like the issue stems from our code generation. Looking at the upstream provider, it appears that the metadataHost field is actually marked as required. See: https://github.com/hashicorp/terraform-provider-azuread/blob/8883d601f73ccd77af340869f1883c32d437dda9/internal/provider/provider.go#L95-L100

From what I understand, the Terraform provider does indeed require this field, but if it is unspecified by the end user explicitly, the defaultFunc will grab the ARM_METADATA_HOSTNAME env value as the default value to be used for the metadata_host field.

It seems like perhaps we'd need a similar handling for our Pulumi Azuread provider as well.

In the meantime as a workaround, you can set the value of metadataHost to be an empty string. For example:

import * as pulumi from "@pulumi/pulumi";
import * as azuread from "@pulumi/azuread";

const Provider = new azuread.Provider("azuread", {
    metadataHost: "",
});

const current = azuread.getClientConfig({});
const example = new azuread.Group("example", {
    displayName: "example",
    owners: [current.then(current => current.objectId)],
    securityEnabled: true,
},
{provider: Provider});

rquitales avatar Apr 28 '23 09:04 rquitales

@rquitales Is that a TF bridge issue? Do we need to move it there?

mikhailshilkov avatar May 08 '23 21:05 mikhailshilkov

@mikhailshilkov Can we just use management.azure.com as the default? The pulumi documentation is incredibly vague in that regard and I spent a solid 10 minutes reading source code to find it.

For reference: https://github.com/hashicorp/terraform-provider-azuread/blob/f94624387682d0bef4b62fb59b7af7d08aab4439/docs/index.md?plain=1#L94

nicklasfrahm avatar May 23 '23 13:05 nicklasfrahm

This issue has been addressed in PR #1233 and shipped in release v5.53.3.

pulumi-bot avatar Jul 22 '24 06:07 pulumi-bot