Compare commits
2 Commits
d7dd7b5947
...
c77485c4a1
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c77485c4a1 | ||
![]() |
755e3be41e |
64
eindopdracht/azure/terraform/main.tf
Normal file
64
eindopdracht/azure/terraform/main.tf
Normal file
@@ -0,0 +1,64 @@
|
||||
# Configure the Azure provider
|
||||
terraform {
|
||||
required_providers {
|
||||
azurerm = {
|
||||
source = "hashicorp/azurerm"
|
||||
version = "~> 2.65"
|
||||
}
|
||||
}
|
||||
|
||||
required_version = ">= 1.1.0"
|
||||
}
|
||||
|
||||
provider "azurerm" {
|
||||
features {}
|
||||
}
|
||||
|
||||
resource "azurerm_resource_group" "rg" {
|
||||
name = "myTFResourceGroup"
|
||||
location = "westeurope"
|
||||
}
|
||||
|
||||
module "vnet" {
|
||||
source = "Azure/vnet/azurerm"
|
||||
resource_group_name = azurerm_resource_group.rg.name
|
||||
address_space = ["10.0.0.0/16"]
|
||||
subnet_prefixes = ["10.0.1.0/24"]
|
||||
subnet_names = ["master"]
|
||||
|
||||
depends_on = [azurerm_resource_group.rg]
|
||||
}
|
||||
|
||||
module "linuxservers" {
|
||||
source = "Azure/compute/azurerm"
|
||||
resource_group_name = azurerm_resource_group.rg.name
|
||||
vm_os_simple = "UbuntuServer"
|
||||
public_ip_dns = ["binddnsserver6"]
|
||||
vnet_subnet_id = module.vnet.vnet_subnets[0]
|
||||
custom_data = <<-EOT
|
||||
#cloud-config
|
||||
bootcmd:
|
||||
- echo "making directories"
|
||||
- mkdir -p /etc/bind
|
||||
- mkdir -p /var/lib/bind
|
||||
- echo "downloading files"
|
||||
- wget https://git.ventilaar.nl/ventilaar/clim/raw/branch/master/eindopdracht/testomgeving/bind/named.conf.local -O /etc/bind/named.conf.local
|
||||
- wget https://git.ventilaar.nl/ventilaar/clim/raw/branch/master/eindopdracht/testomgeving/bind/dns.mashallah.nl.zone -O /var/lib/bind/dns.mashallah.nl.zone
|
||||
packages:
|
||||
- bind9
|
||||
EOT
|
||||
delete_data_disks_on_termination = true
|
||||
delete_os_disk_on_termination = true
|
||||
vm_hostname = "bind"
|
||||
vm_size = "Standard_B1ls"
|
||||
ssh_key = "~/.ssh/id_rsa.pub.old"
|
||||
remote_port = "53"
|
||||
|
||||
depends_on = [azurerm_resource_group.rg]
|
||||
}
|
||||
|
||||
|
||||
|
||||
output "linux_vm_public_name" {
|
||||
value = module.linuxservers.public_ip_dns_name
|
||||
}
|
Reference in New Issue
Block a user