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

BUG using Azapi_resource for logic_app authsettingsv2 #677

Open
JorgeFreitas5 opened this issue Nov 20, 2024 · 1 comment
Open

BUG using Azapi_resource for logic_app authsettingsv2 #677

JorgeFreitas5 opened this issue Nov 20, 2024 · 1 comment
Labels
example Example request

Comments

@JorgeFreitas5
Copy link

I am updating my logic_app code with azapi_resource in order to add identity provider and authentication_settings.
Everything went well until when I try to run the tf apply.

My code:

resource "azapi_resource" "logic_app_auth_setting" {

  name = "authsettingsV2"
  parent_id = example.logicapp.id
  location = "northeurope"
  schema_validation_enabled = false
  body = {
    kind = "string"
    name = "authsettingsV2"
    properties = {
      globalValidation = {
        requireAuthentication = true
        unauthenticatedClientAction = "Return401"
      }
      identityProviders = {
        azureActiveDirectory = {
          enabled = true
          registration = {
            clientId     = "example_client_id"           
            openIdIssuer = "https://sts.windows.net/example/v2.0" 
          }
          validation = {
            defaultAuthorizationPolicy = {
              allowedApplications = ["random_application"]
            }
          }
        }
      }
      login = {
        tokenStore = {
          enabled = true
        }
      }
      platform = {
        enabled        = true
        runtimeVersion = "~1"
      }
    }
  }
}

As you can see here I am using schema_validation_enabled = false because if the terraform does the validation we receive this error:
Image

What I think is happening is the first location outside body is interfering somehow with the body validation returning that error.
I already tried to remove the location in order to test if the validation is correct but it tries to replace the config what is impossible to be destroyed
Image

@ms-henglu ms-henglu added the example Example request label Nov 25, 2024
@ms-henglu
Copy link
Member

Hi @JorgeFreitas5 ,

Thank you for taking time to report this issue.

The "Microsoft.Web/sites/config@2022-09-01" API doesn't support GET and DELETE methods, so it can't work well with the azapi_resource. Here's a workaround, hope it could help you.

https://github.com/Azure/terraform-provider-azapi/blob/main/examples/Microsoft.Web_sites_config%402022-09-01/main.tf#L95

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
example Example request
Projects
None yet
Development

No branches or pull requests

2 participants