Skip to content

Instantly share code, notes, and snippets.

@JorTurFer JorTurFer/main.tf
Created Apr 8, 2019

Embed
What would you like to do?
provider "azurerm" {
version = ">= 1.6.0"
subscription_id = "${var.ID_Suscripcion}"
client_id = "${var.ID_Aplicacion}"
client_secret = "${var.Password_Aplicacion}"
tenant_id = "${var.ID_Tenant}"
}
terraform {
required_version = ">= 0.11.13"
}
//Creamos el grupo de recursos para nuestra Web App
resource "azurerm_resource_group" "webapp" {
name = "${var.resource_group_name}"
location = "${var.location}"
}
//Creamos el service plan para nuestra Web App
resource "azurerm_app_service_plan" "webserviceplan" {
name = "${var.service_plan_name}"
location = "${azurerm_resource_group.webapp.location}"
resource_group_name = "${azurerm_resource_group.webapp.name}"
kind = "${var.plan_settings["kind"]}"
sku {
tier = "${var.plan_settings["tier"]}"
size = "${var.plan_settings["size"]}"
capacity = "${var.plan_settings["capacity"]}"
}
}
//Creamos la Web App
resource "azurerm_app_service" "webapp" {
name = "${var.name}"
location = "${azurerm_resource_group.webapp.location}"
resource_group_name = "${azurerm_resource_group.webapp.name}"
app_service_plan_id = "${azurerm_app_service_plan.webserviceplan.id}"
}
//Creamos las variables
variable "location" {
description = "Region donde queremos que se cree"
}
variable "resource_group_name" {
description = "Nombre del grupo de recursos"
}
variable "plan_settings" {
type = "map"
description = "Definimos el tipo de plan que vamos a utilizar"
default = {
kind = "Windows" # Linux or Windows
size = "S1"
capacity = 1
tier = "Standard"
}
}
variable "ID_Suscripcion" {
description = "ID de la suscripción de Azure"
}
variable "ID_Aplicacion" {
description = "ID del la aplicación"
}
variable "Password_Aplicacion" {
description = "Secreto de la aplicación"
}
variable "ID_Tenant" {
description = "ID del directorio activo de Azure"
}
variable "name" {
description = "Nombre de la Web App"
}
variable "service_plan_name" {
description = "Nombre del service plan"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.