ine-labs / AzureGoat

AzureGoat : A Damn Vulnerable Azure Infrastructure
MIT License
776 stars 177 forks source link

Deprecated resource: `azurerm_app_service_plan` #16

Closed za closed 1 month ago

za commented 9 months ago

Hi there, I am getting this while running terraform init:

Plan: 1 to add, 0 to change, 0 to destroy.
╷
│ Warning: Deprecated Resource
│ 
│   with azurerm_app_service_plan.app_service_plan,
│   on main.tf line 152, in resource "azurerm_app_service_plan" "app_service_plan":
│  152: resource "azurerm_app_service_plan" "app_service_plan" {
│ 
│ The `azurerm_app_service_plan` resource has been superseded by the `azurerm_service_plan` resource. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen
│ for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider.
│ 
│ (and 2 more similar warnings elsewhere)
anachary commented 9 months ago

Hi @za , I encountered exact same issue running when from on local environment, however when I clone the repo in azure cloud cli and ran terraform script in azure cloud cli, everything worked like charm.

Invisible4d commented 6 months ago

I encountered this issue on azure CLI... after running terraform apply --auto-approve

Warning: Deprecated Resource
│ 
│   with azurerm_app_service_plan.app_service_plan,
│   on main.tf line 152, in resource "azurerm_app_service_plan" "app_service_plan":
│  152: resource "azurerm_app_service_plan" "app_service_plan" {
│ 
│ The `azurerm_app_service_plan` resource has been superseded by the `azurerm_service_plan` resource. Whilst this resource will continue to be available in the 2.x and 3.x releases it is
│ feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider.
│ 
│ (and 7 more similar warnings elsewhere) 
MissingLink89 commented 1 month ago

I'm also getting this issue

│ Warning: Deprecated Resource
│ 
│   with azurerm_app_service_plan.app_service_plan,
│   on main.tf line 152, in resource "azurerm_app_service_plan" "app_service_plan":
│  152: resource "azurerm_app_service_plan" "app_service_plan" {
│ 
│ The `azurerm_app_service_plan` resource has been superseded by the `azurerm_service_plan` resource. Whilst this resource will continue to be available in the 2.x and 3.x
│ releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider.
│ 
│ (and 6 more similar warnings elsewhere)
╵
╷
│ Error: creating/updating App Service Plan: (Serverfarm Name "appazgoat12088765-app-service-plan" / Resource Group "azuregoat_app"): web.AppServicePlansClient#CreateOrUpdate: Failure sending request: StatusCode=401 -- Original Error: Code="Unauthorized" Message="This region has quota of 0 instances for your subscription. Try selecting different region or SKU." Details=[{"Message":"This region has quota of 0 instances for your subscription. Try selecting different region or SKU."},{"Code":"Unauthorized"},{"ErrorEntity":{"Code":"Unauthorized","ExtendedCode":"52039","Message":"This region has quota of 0 instances for your subscription. Try selecting different region or SKU.","MessageTemplate":"{0}. Try selecting different region or SKU.","Parameters":["This region has quota of 0 instances for your subscription"]}}]
│ 
│   with azurerm_app_service_plan.app_service_plan,
│   on main.tf line 152, in resource "azurerm_app_service_plan" "app_service_plan":
│  152: resource "azurerm_app_service_plan" "app_service_plan" {

I'm new to this stuff but so far, I've found the terraform module: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/service_plan But it requires os_type and sku_name to be defined. But are there other dependencies to it? Happy to help

s0ulix commented 1 month ago

Hi @MissingLink89 ,

For the warning about the deprecated resource, it’s safe to ignore as it doesn’t affect functionality, the resources are deploying correctly despite this.

Regarding the error, it’s due to a quota issue with your subscription. You can:

  1. Try an alternate region: Change eastus to another region, for example, eastus2, in the main.tf file at this line, or

  2. Pass the region during the command: terraform apply -var="location=eastus2" --auto-approve.

Alternatively, you can contact Azure support for a quota increase in the East US region.

MissingLink89 commented 1 month ago

Hey @s0ulix , Changing me region worked. So for me because im in Australia, deploying to my region had no errors. Thanks for responding.