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

Unable to create App Service Plans for Logic Apps with azurerm_service_plan #16401

Closed
1 task done
JameySteinmann opened this issue Apr 15, 2022 · 6 comments
Closed
1 task done

Comments

@JameySteinmann
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.1.8

AzureRM Provider Version

3.1.0

Affected Resource(s)/Data Source(s)

azurerm_service_plan, azurerm_app_service_plan

Terraform Configuration Files

resource "azurerm_resource_group" "rg" {
  name = "${terraform.workspace}-RG"
  location = "East US"
}

#Working via deprecated azurerm_app_service_plan
resource "azurerm_app_service_plan" "plan" {
  name = "ASP-${terraform.workspace}"
  location = "East US"
  resource_group_name = azurerm_resource_group.rg.name
  kind = "elastic"
  sku {
    tier = "WorkflowStandard"
    size = "WS1"
  }
}

#Non-working azurerm_service_plan
resource "azurerm_service_plan" "plan" {
  name = "SP-${terraform.workspace}"
  location = "East US"
  resource_group_name = azurerm_resource_group.rg.name
  sku_name = "WS1"
}

Debug Output/Panic Output

#This is the data source via azurerm_service_plan for a working App Service Plan that allows logic apps to be attached to it. The data source also seems to be missing some components when compared to the data source of azurerm_app_service_plan of the same resource.

    {
      "mode": "data",
      "type": "azurerm_service_plan",
      "name": "manual",
      "provider": "provider[\"registry.terraform.io/hashicorp/azurerm\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "app_service_environment_id": "",
            "id": "/subscriptions/ac688153-f123-67b8-a19f-d1cecc0d2599/resourceGroups/la-plan-test-RG/providers/Microsoft.Web/serverfarms/ASP-la-plan-test",
            "kind": "",
            "location": "eastus",
            "maximum_elastic_worker_count": 20,
            "name": "ASP-la-plan-test",
            "os_type": "",
            "per_site_scaling_enabled": false,
            "reserved": false,
            "resource_group_name": "la-plan-test-RG",
            "sku_name": "WS1",
            "tags": {},
            "timeouts": null,
            "worker_count": 1,
            "zone_balancing_enabled": false
          },
          "sensitive_attributes": []
        }
      ]
    }


    {
      "mode": "data",
      "type": "azurerm_app_service_plan",
      "name": "manual",
      "provider": "provider[\"registry.terraform.io/hashicorp/azurerm\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "app_service_environment_id": null,
            "id": "/subscriptions/ac688153-f123-67b8-a19f-d1cecc0d2599/resourceGroups/la-plan-test-RG/providers/Microsoft.Web/serverfarms/ASP-la-plan-test",
            "is_xenon": false,
            "kind": "elastic",
            "location": "eastus",
            "maximum_elastic_worker_count": 20,
            "maximum_number_of_workers": 20,
            "name": "ASP-la-plan-test",
            "per_site_scaling": false,
            "reserved": false,
            "resource_group_name": "la-plan-test-RG",
            "sku": [
              {
                "capacity": 1,
                "size": "WS1",
                "tier": "WorkflowStandard"
              }
            ],
            "tags": {},
            "timeouts": null,
            "zone_redundant": false
          },
          "sensitive_attributes": []
        }
      ]
    }

Expected Behaviour

When using the WS1, WS2, or WS3 sku name for an azurerm_service_plan it should create an app service plan in Azure that shows as an "Elastic App"

When using the data source the kind should show as elastic

Actual Behaviour

When using the WS1, WS2, or WS3 sku names for an azurerm_service_plan it results in creating an App Service Plan and Logic Apps are not able to be deployed via azure to them. You can deploy them with Terraform, however they fail to run due to the wrong Service Plan being created in Azure.

When using the data source the kind shows as ""

Steps to Reproduce

  1. Deploy an azurerm_service_plan using WS1, WS2, or WS3 skus
  • Create an azurerm_logic_app_standard resource using this service plan and navigate to workflows in Azure to see a resulting hosting error message
  • Manually create a logic app in the Azure Portal and note that you are unable to select the service plan to deploy the logic app
  1. Deploy an azurerm_app_service_plan using WS1, WS2, or WS3 skus, set kind to "elastic" and tier to "WorkflowStandard"
  • Create an azurerm_logic_app_standard resource using the service plan and see the when navigating to workflows in the Azure Portal that it will allow you to add workflows
  • Manually create a logic app in the Azure Portal and note that you are able to use the service plan to deploy to

Important Factoids

No response

References

No response

@sinbai
Copy link
Contributor

sinbai commented Apr 15, 2022

@JameySteinmann thank you for posting this issue here. Unfortunately, I could not reproduce the above issue. After creating an App Service Plans for Logic Apps with azurerm_service_plan(tf configuration below), there is no error message in workflows in Azure and the service plan(SP-01) is available when manually deploying the logic app in the Azure Portal. Could you compare the tf config with yours and try to reproduce with it?


provider "azurerm" {
  features {}
}

terraform {
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
	  version = "3.1.0"
    }
  }
}

resource "azurerm_resource_group" "test" {
  name     = "rg-sample"
  location = "eastus"
}

resource "azurerm_service_plan" "test" {
  name                = "SP-01"
  resource_group_name = azurerm_resource_group.test.name
  location            = azurerm_resource_group.test.location
  sku_name            = "WS1"
  os_type             = "Windows"
}

resource "azurerm_storage_account" "test" {
  name                     = "functionapptest0415"
  resource_group_name      = azurerm_resource_group.test.name
  location                 = azurerm_resource_group.test.location
  account_tier             = "Standard"
  account_replication_type = "LRS"
}

resource "azurerm_logic_app_standard" "test" {
  name                       = "logic-sample"
  location                   = azurerm_resource_group.test.location
  resource_group_name        = azurerm_resource_group.test.name
  app_service_plan_id        = azurerm_service_plan.test.id
  storage_account_name       = azurerm_storage_account.test.name
  storage_account_access_key = azurerm_storage_account.test.primary_access_key
}

image

@JameySteinmann
Copy link
Author

JameySteinmann commented Apr 15, 2022

Thank you @sinbai. It appears that you have to set the os_type = "Windows" for this to work. I tested it in 3.1.0 and 3.2.0 and it works as you showed. This is a departure from how you would do it in azurerm_app_service_plan and isn't documented. Perhaps this request can just serve to update the docs with a note that when using WS1, WS2, and WS3 skus that they're only available in the os_type = "Windows". Is this the right spot for it, or should I close this and open a new report for just the documentation update?

edit: The data source may still need to be updated to output the os_type as "Windows" instead of "" since using the attributes returned to create another service plan would yield an unusable plan for logic apps

@sinbai
Copy link
Contributor

sinbai commented Apr 18, 2022

@JameySteinmann thanks for your feedback. In fact, when using WS1, WS2, and WS3 skus, they're available both "Windows" and "Linux". In my sample, os_type is set to "Windows" simply because "is_xenon": false and "reserved": false in the information provided below. This means the os_type neither WindowsContainer nor Linux.

 {
      "mode": "data",
      "type": "azurerm_app_service_plan",
      "name": "manual",
      "provider": "provider[\"registry.terraform.io/hashicorp/azurerm\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "app_service_environment_id": null,
            "id": "/subscriptions/ac688153-f123-67b8-a19f-d1cecc0d2599/resourceGroups/la-plan-test-RG/providers/Microsoft.Web/serverfarms/ASP-la-plan-test",
            "is_xenon": false,
            "kind": "elastic",
            "location": "eastus",
            "maximum_elastic_worker_count": 20,
            "maximum_number_of_workers": 20,
            "name": "ASP-la-plan-test",
            "per_site_scaling": false,
            "reserved": false,
            "resource_group_name": "la-plan-test-RG",
            "sku": [
              {
                "capacity": 1,
                "size": "WS1",
                "tier": "WorkflowStandard"
              }
            ],
            "tags": {},
            "timeouts": null,
            "zone_redundant": false
          },
          "sensitive_attributes": []
        }
      ]
    }

For the data source issue, I have submitted a PR to fix it. Thanks again for posting this here.

@JameySteinmann
Copy link
Author

You're welcome @sinbai. I have another bug as they relate to creating the logic apps do not work, but I'll file another bug for this.

katbyte pushed a commit that referenced this issue May 5, 2022
…os_type” properties issue (#16431)

Co-authored-by: jackofallops <11830746+jackofallops@users.noreply.github.com>
Co-authored-by: kt <kt@katbyte.me>

Fix issue #16401.
@katbyte katbyte added this to the v3.5.0 milestone May 5, 2022
@katbyte katbyte closed this as completed May 5, 2022
@github-actions
Copy link

github-actions bot commented May 6, 2022

This functionality has been released in v3.5.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

github-actions bot commented Jun 5, 2022

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, 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 Jun 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants