Created
January 11, 2023 13:34
-
-
Save mikaelkrief/634104974f45c34eec3686124d3ce851 to your computer and use it in GitHub Desktop.
Terraform code from infracost demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
terraform { | |
required_version = "~> 1.0" | |
required_providers { | |
azurerm = { | |
version = "~> 3.35" | |
} | |
} | |
} | |
provider "azurerm" { | |
features {} | |
} | |
resource "azurerm_resource_group" "rg" { | |
name = "rg-demo" | |
location = "West Europe" | |
} | |
resource "azurerm_virtual_network" "vnet" { | |
name = "vnet-demo" | |
address_space = ["10.0.0.0/16"] | |
location = azurerm_resource_group.rg.location | |
resource_group_name = azurerm_resource_group.rg.name | |
} | |
resource "azurerm_subnet" "subnet" { | |
name = "subnet-demo" | |
resource_group_name = azurerm_resource_group.rg.name | |
virtual_network_name = azurerm_virtual_network.vnet.name | |
address_prefixes = ["10.0.2.0/24"] | |
} | |
resource "azurerm_network_interface" "nic" { | |
name = "nic-demo" | |
location = azurerm_resource_group.rg.location | |
resource_group_name = azurerm_resource_group.rg.name | |
ip_configuration { | |
name = "internal" | |
subnet_id = azurerm_subnet.subnet.id | |
private_ip_address_allocation = "Dynamic" | |
} | |
} | |
resource "azurerm_linux_virtual_machine" "vm" { | |
name = "vm-demo" | |
resource_group_name = azurerm_resource_group.rg.name | |
location = azurerm_resource_group.rg.location | |
size = "Standard_DS2_V2" | |
disable_password_authentication = false | |
admin_username = "adminuser" | |
admin_password = "P@ssw0rd123*" | |
network_interface_ids = [ | |
azurerm_network_interface.nic.id, | |
] | |
os_disk { | |
caching = "ReadWrite" | |
storage_account_type = "Standard_LRS" | |
} | |
source_image_reference { | |
publisher = "Canonical" | |
offer = "UbuntuServer" | |
sku = "18.04-LTS" | |
version = "latest" | |
} | |
} | |
resource "azurerm_service_plan" "plan-app" { | |
name = "splan" | |
location = azurerm_resource_group.rg.location | |
resource_group_name = azurerm_resource_group.rg.name | |
os_type = "Linux" | |
sku_name = "B1" | |
} | |
resource "azurerm_linux_web_app" "app" { | |
name = "webappdemobook1001" | |
location = azurerm_resource_group.rg.location | |
resource_group_name = azurerm_resource_group.rg.name | |
service_plan_id = azurerm_service_plan.plan-app.id | |
site_config {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment