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

Error running terraform plan on App Service Plan deleted outside of Terraform #3584

Closed
joakimhellum opened this issue Jun 4, 2019 · 10 comments

Comments

@joakimhellum
Copy link

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 (and AzureRM Provider) Version

Terraform v0.12.0
+ provider.azurerm v1.29.0

Affected Resource(s)

  • azurerm_app_service_plan

Terraform Configuration Files

resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "westeurope"
}

resource "azurerm_app_service_plan" "example" {
  name                = "example-plan"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name

  sku {
    tier = "Basic"
    size = "B1"
  }
}

Debug Output

https://gist.github.com/joakimhellum-in/7a5d2d065d178f85add5e2c037304f87

Panic Output

N/A

Expected Behavior

Terraform to plan resource changes.

Actual Behavior

Terraform exits with an error message:
Error: insufficient items for attribute "sku"; must have at least 1

Steps to Reproduce

  1. Run terraform init.
  2. Run terraform apply.
  3. Delete the App Service Plan outside of Terraform, for example: az appservice plan delete -n example-plan -g example-resources.
  4. Run terraform plan.

Important Factoids

  • Error occurs when running terraform plan on an App Service Plan that has been deleted outside of Terraform.
  • Can reproduce issue on Terraform v0.12 (v0.12.0 and build from master), but not v0.11.
  • So far I didn't experience this with other resources that uses similar sku attribute.

References

@ghost
Copy link

ghost commented Jul 10, 2019

Same issues, the problem was solved by removing the tfstate file (it was a test environment)

@MikeGBurns
Copy link

Same issue with azurerm_sql_server. Removing tfstate worked.

@unbkbl
Copy link

unbkbl commented Jul 30, 2019

I'm having the same issue with:

Terraform v0.12.4

  • provider.azurerm v1.32.0

I'm trying to recreate a lost tfstate file using import, so obviously deleting it tfstate file is not going to solve my problem

@unbkbl
Copy link

unbkbl commented Aug 1, 2019

still having the problem in version 0.12.6

@alexeyandriyash
Copy link

alexeyandriyash commented Aug 1, 2019

Workarounded by provider.azurerm version downgrade to 1.27.0, Terraform version is still 0.12.4

@mbfrahry
Copy link
Member

mbfrahry commented Aug 1, 2019

Hey all. Thanks for opening this issue @joakimhellum-in. It looks like the azure sdk for app service plans doesn't return an error on 404 which is how we normally handle a deletion outside of terraform. I've implemented a workaround with #3990 and opened an issue on the sdk repo to get this addressed. Thanks for your patience here!

@mbfrahry
Copy link
Member

mbfrahry commented Aug 1, 2019

The workaround has been merged and will it make it into the next release. Closing this down but feel free to reopen if you continue to have issues after the next release goes out.

@mbfrahry mbfrahry closed this as completed Aug 1, 2019
@unbkbl
Copy link

unbkbl commented Aug 1, 2019

Workarounded by provider.azurerm version downgrade to 1.27.0, Terraform version is still 0.12.4
it worked!! thaaanks!

@opticyclic
Copy link

I has been released:

provider "azurerm" {
  version         = "~> 1.33.0"
}

@tombuildsstuff tombuildsstuff added this to the v1.33.0 milestone Aug 27, 2019
@ghost
Copy link

ghost commented Sep 1, 2019

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 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Sep 1, 2019
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

8 participants