Hey everyone,
I’m trying to create an App Service in Azure using a pipeline with terraform, my question is :
It is possible to create an App Service using an existing resource group previously created ?
-
This is the error the im getting:
Error: A resource with the ID “/subscriptions/xxxxxx-xxxxxxxxx-xxxxxxxxxx-xxxxxxxxx/resourceGroups/DevOps_group” already exists -
This is my actual code:
terraform {
required_providers {
azurerm = {
source = “hashicorp/azurerm”
version = “2.85.0”
}
}
}
provider “azurerm” {
features {}
}
#Definindo Resource Group
resource “azurerm_resource_group” “rg” {
name = “DevOps_group”
}
#Definindo Service Plan
resource “azurerm_app_service_plan” “serviceplan” {
name = “appserviceplan-devops”
location = “westus2”
resource_group_name = azurerm_resource_group.rg.name
kind = “Linux”
reserved = true
sku {
tier = “Basic”
size = “B1”
}
}
#Criando App Service
resource “azurerm_app_service” “app-service” {
name = “app-service-devops”
location = “westus2”
resource_group_name = azurerm_resource_group.rg.name
app_service_plan_id = azurerm_app_service_plan.serviceplan.id
site_config {
linux_fx_version = “DOCKER|containerregistry.azurecr.io/devops-container”
}
}
=======