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

Terraform unable to handle success StatusCode #1012

Closed
Phydeauxman opened this issue Mar 20, 2018 · 3 comments
Closed

Terraform unable to handle success StatusCode #1012

Phydeauxman opened this issue Mar 20, 2018 · 3 comments
Labels
bug service/app-service upstream/microsoft Indicates that there's an upstream issue blocking this issue/PR v/1.x (legacy)

Comments

@Phydeauxman
Copy link

Phydeauxman commented Mar 20, 2018

I have a configuration to deploy an App Service Plan into an existing App Service Environment v2. The app service plan creates fine but terraform errors out on the returned StatusCode of 201.

Terraform Version

Terraform v0.11.3

  • provider.azurerm v1.3.0

Affected Resource(s)

  • azurerm_app_service_plan

Terraform Configuration Files

provider "azurerm" {
  subscription_id = "${var.sub_id}"
}

data "terraform_remote_state" "ase" {
  backend = "azurerm"

  config {
    storage_account_name = "${var.tfstate_storage_account}"
    container_name       = "${var.tfstate_container}"
    key                  = "${var.tfstate_asestate_file}"
    access_key           = "${var.tfstate_access_key}"
  }
}

resource "azurerm_app_service_plan" "asp1" {
  name                = "${var.asp1_name}"
  location            = "${var.region}"
  resource_group_name = "${data.terraform_remote_state.ase.asergname}"

  sku {
    tier = "${var.asp1_sku_tier}"
    size = "${var.asp1_sku_size}"
  }

  properties {
    app_service_environment_id = "${data.terraform_remote_state.ase.aseResourceId}"
  }
}

Expected Behavior

The App Service Plan should have been provisioned and terraform should have completed successfully by updating the state file with data from the successful deployment

Actual Behavior

Terraform errors out with the following error:

Error: Error applying plan:

1 error(s) occurred:

* azurerm_app_service_plan.asp1: 1 error(s) occurred:

* azurerm_app_service_plan.asp1: web.AppServicePlansClient#CreateOrUpdate: Failure sending request: StatusCode=201 -- Original Error: autorest/azure: Service returned an error. Status=201 Code="Unknown" Message="Unknown service error"

Steps to Reproduce

  1. Ensure existing App Service Environment v2 is in place
  2. terraform apply

Important Factoids

Below is the status code from the Azure Activity events generated by the deployment:

"status": {
        "value": "Succeeded",
        "localizedValue": "Succeeded"
    },
    "subStatus": {
        "value": "Created",
        "localizedValue": "Created (HTTP Status Code: 201)"
    },
@tombuildsstuff tombuildsstuff added bug service/app-service upstream/microsoft Indicates that there's an upstream issue blocking this issue/PR labels Mar 20, 2018
@tombuildsstuff
Copy link
Contributor

hi @Phydeauxman

Thanks for opening this issue :)

Unfortunately this is a bug in the Azure API where the status code 201 can be returned from the API but isn't actually a supported status code according to the SDK/Swagger definition (which is why an errors being returned).

The latest update is available in this comment, but we're currently waiting for the Web/App Service team to confirm that this is a valid status code returned from the API, to allow the Swagger file which defines the API that the Azure SDK is generated from to be updated. Rather than having multiple issues tracking the same thing, I'm going to close this in favour of #917.

Thanks!

@Phydeauxman
Copy link
Author

@tombuildsstuff Thanks for the info. Guess for now I will deploy with an embedded ARM template.

@ghost
Copy link

ghost commented Mar 31, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug service/app-service upstream/microsoft Indicates that there's an upstream issue blocking this issue/PR v/1.x (legacy)
Projects
None yet
Development

No branches or pull requests

3 participants