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

app_service - add authv2 to functionapps and functionapp slots #20722

Merged
merged 8 commits into from
Mar 2, 2023

Conversation

jackofallops
Copy link
Member

@jackofallops jackofallops commented Mar 1, 2023

  • azurerm_linux_function_app - add support for AuthV2 (EasyAuthV2) auth_settings_v2
  • azurerm_linux_function_app_slot - add support for AuthV2 (EasyAuthV2) auth_settings_v2
  • azurerm_windows_function_app - add support for AuthV2 (EasyAuthV2) auth_settings_v2
  • azurerm_windows_function_app_slot - add support for AuthV2 (EasyAuthV2) auth_settings_v2
  • Data Source: azurerm_linux_function_app - add support for AuthV2 (EasyAuthV2) auth_settings_v2
  • Data Source:azurerm_windows_function_app - add support for AuthV2 (EasyAuthV2) auth_settings_v2
  • TODO - Update all docs

@jackofallops jackofallops marked this pull request as ready for review March 1, 2023 19:14
@jackofallops jackofallops requested a review from a team March 2, 2023 09:12
Copy link
Contributor

@manicminer manicminer left a comment

Choose a reason for hiding this comment

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

Spotted a few error texts, but otherwise LGTM 🪕

@@ -316,6 +319,11 @@ func (d WindowsFunctionAppDataSource) Read() sdk.ResourceFunc {
return fmt.Errorf("reading Auth Settings for Windows %s: %+v", id, err)
}

authV2, err := client.GetAuthSettingsV2(ctx, id.ResourceGroup, id.SiteName)
if err != nil {
return fmt.Errorf("reading authV2 settings for Linux %s: %+v", id, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("reading authV2 settings for Linux %s: %+v", id, err)
return fmt.Errorf("reading authV2 settings for Windows %s: %+v", id, err)

authv2 := helpers.ExpandAuthV2Settings(functionApp.AuthV2Settings)
if authv2.SiteAuthSettingsV2Properties != nil {
if _, err = client.UpdateAuthSettingsV2(ctx, id.ResourceGroup, id.SiteName, *authv2); err != nil {
return fmt.Errorf("updating AuthV2 settings for Linux %s: %+v", id, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("updating AuthV2 settings for Linux %s: %+v", id, err)
return fmt.Errorf("updating AuthV2 settings for Windows %s: %+v", id, err)

if strings.EqualFold(pointer.From(auth.ConfigVersion), "v2") {
authV2, err = client.GetAuthSettingsV2(ctx, id.ResourceGroup, id.SiteName)
if err != nil {
return fmt.Errorf("reading authV2 settings for Linux %s: %+v", *id, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("reading authV2 settings for Linux %s: %+v", *id, err)
return fmt.Errorf("reading authV2 settings for Windows %s: %+v", *id, err)

if _, err := client.UpdateAuthSettings(ctx, id.ResourceGroup, id.SiteName, *authUpdate); err != nil {
return fmt.Errorf("updating Auth Settings for Windows %s: %+v", id, err)
return fmt.Errorf("updating Auth Settings for Linux %s: %+v", id, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("updating Auth Settings for Linux %s: %+v", id, err)
return fmt.Errorf("updating Auth Settings for Windows %s: %+v", id, err)

if metadata.ResourceData.HasChange("auth_settings_v2") {
authV2Update := helpers.ExpandAuthV2Settings(state.AuthV2Settings)
if _, err := client.UpdateAuthSettingsV2(ctx, id.ResourceGroup, id.SiteName, *authV2Update); err != nil {
return fmt.Errorf("updating AuthV2 Settings for Linux %s: %+v", id, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("updating AuthV2 Settings for Linux %s: %+v", id, err)
return fmt.Errorf("updating AuthV2 Settings for Windows %s: %+v", id, err)

authv2 := helpers.ExpandAuthV2Settings(functionAppSlot.AuthV2Settings)
if authv2.SiteAuthSettingsV2Properties != nil {
if _, err = client.UpdateAuthSettingsV2Slot(ctx, id.ResourceGroup, id.SiteName, *authv2, id.SlotName); err != nil {
return fmt.Errorf("updating AuthV2 settings for Linux %s: %+v", id, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("updating AuthV2 settings for Linux %s: %+v", id, err)
return fmt.Errorf("updating AuthV2 settings for Windows %s: %+v", id, err)

if strings.EqualFold(pointer.From(auth.ConfigVersion), "v2") {
authV2, err = client.GetAuthSettingsV2Slot(ctx, id.ResourceGroup, id.SiteName, id.SlotName)
if err != nil {
return fmt.Errorf("reading authV2 settings for Linux %s: %+v", *id, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("reading authV2 settings for Linux %s: %+v", *id, err)
return fmt.Errorf("reading authV2 settings for Windows %s: %+v", *id, err)

if _, err := client.UpdateAuthSettingsSlot(ctx, id.ResourceGroup, id.SiteName, *authUpdate, id.SlotName); err != nil {
return fmt.Errorf("updating Auth Settings for Windows %s: %+v", id, err)
return fmt.Errorf("updating Auth Settings for Linux %s: %+v", id, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("updating Auth Settings for Linux %s: %+v", id, err)
return fmt.Errorf("updating Auth Settings for Windows %s: %+v", id, err)

if metadata.ResourceData.HasChange("auth_settings_v2") {
authV2Update := helpers.ExpandAuthV2Settings(state.AuthV2Settings)
if _, err := client.UpdateAuthSettingsV2Slot(ctx, id.ResourceGroup, id.SiteName, *authV2Update, id.SlotName); err != nil {
return fmt.Errorf("updating AuthV2 Settings for Linux %s: %+v", id, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("updating AuthV2 Settings for Linux %s: %+v", id, err)
return fmt.Errorf("updating AuthV2 Settings for Windows %s: %+v", id, err)

@manicminer manicminer added this to the v3.46.0 milestone Mar 2, 2023
@jackofallops jackofallops merged commit 29b0355 into main Mar 2, 2023
@jackofallops jackofallops deleted the f/function-apps-authv2 branch March 2, 2023 16:23
jackofallops added a commit that referenced this pull request Mar 2, 2023
@github-actions
Copy link

github-actions bot commented Mar 6, 2023

This functionality has been released in v3.46.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 Apr 17, 2023
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.

2 participants