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

Support for v2 auth tokens (i.e. MSAL) #14403

Merged
merged 7 commits into from
Jan 28, 2022
Merged

Conversation

manicminer
Copy link
Contributor

@manicminer manicminer commented Nov 30, 2021

  • This is opt-in behavior via the provider property use_msal, and environment variables ARM_USE_MSAL / ARM_USE_MSGRAPH (the latter for compatibility with the related backend property

  • When use_msal is true, do not make any API calls to a graph API (legacy or current). There are only 2 uses of this at present:

    • data.azurerm_client_config, which doesn't actually do anything with the result so this appears to be a vestige anyway
    • azurerm_hdinsight_kafka_cluster, the API for which requires both an AAD group ID and name to be specified (?) so currently this resource looks up the group name from the supplied ID. In future we'll require that both are specified (e.g. using data.azuread_group for any necessary lookup)
  • In v3.0, we'll enable v2 tokens provider-wide, and remove support for graph clients in order to delegate any required usage to the AzureAD provider.

  • Also removes support for Azure Germany, which is now offline

This PR depends on hashicorp/go-azure-helpers#90 and should be rebased accordingly.

Note: Tests for azurerm_hdinsight_kafka_cluster are currently failing due to #12417

Related: #12443

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @manicminer

Thanks for this PR - apologies for the delayed review on this one.

I've taken a look through and left a few comments inline, but if we can fix those up then this should otherwise be good to go 👍

Thanks!

internal/clients/auth.go Outdated Show resolved Hide resolved
internal/provider/provider.go Outdated Show resolved Hide resolved
internal/provider/provider.go Outdated Show resolved Hide resolved
website/docs/index.html.markdown Outdated Show resolved Hide resolved
manicminer and others added 5 commits January 25, 2022 14:15
- This is opt-in behaviour via the provider property `use_msal`, and
  environment variables `ARM_USE_MSAL` / `ARM_USE_MSGRAPH` (the latter
  for compatibility with the related backend property

- When `use_msal` is true, do not make any API calls to a graph API
  (legacy or current). There are only 2 uses of this at present:

  - `data.azurerm_client_config`, which doesn't actually do anything
    with the result so this appears to be a vestige anyway
  - `azurerm_hdinsight_kafka_cluster`, the API for which requires
    both an AAD group ID and name to be specified (?) so currently
    this resource looks up the group name from the supplied ID. In
    future we'll require that both are specified (e.g. using
    `data.azuread_group` for any necessary lookup)

- In v3.0, we'll remove support for graph clients in order to delegate
  any required usage to the AzureAD provider.

- Also removes support for Azure Germany, which is now offline
Co-authored-by: Tom Harvey <tombuildsstuff@users.noreply.github.com>
@tombuildsstuff
Copy link
Contributor

Rebased on top of #15043 / main

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from the 2 pending comments above, this otherwise looks fine to me after a rebase 👍

@manicminer
Copy link
Contributor Author

@tombuildsstuff Thanks for the review & rebase. I've updated the default value for use_msal so that it's false in v2.x, and true in v3.x (with the option to disable it in v3), with a view to removing ADAL token support entirely in v4.0?

@tombuildsstuff tombuildsstuff modified the milestones: v2.94.0, v2.95.0 Jan 27, 2022
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment about always enabling this in 3.0 - otherwise this is fine 🦖

internal/provider/provider.go Outdated Show resolved Hide resolved
Co-authored-by: Tom Harvey <tombuildsstuff@users.noreply.github.com>
@manicminer manicminer modified the milestones: v2.95.0, v2.94.0 Jan 28, 2022
@manicminer manicminer merged commit f2a1ab7 into main Jan 28, 2022
@manicminer manicminer deleted the feature/v2-auth-tokens branch January 28, 2022 02:19
manicminer added a commit that referenced this pull request Jan 28, 2022
@github-actions
Copy link

This functionality has been released in v2.94.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants