Skip to content

Commit aa1b03c

Browse files
committed
ci: Added hosting as code using Terraform
1 parent 5ecff47 commit aa1b03c

File tree

3 files changed

+104
-7
lines changed

3 files changed

+104
-7
lines changed

.gitignore

+3-7
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ node_modules
99
vite.config.js.timestamp-*
1010
vite.config.ts.timestamp-*
1111
.azure
12-
.yarn/*
13-
!.yarn/cache
14-
!.yarn/patches
15-
!.yarn/plugins
16-
!.yarn/releases
17-
!.yarn/sdks
18-
!.yarn/versions
12+
.terraform/
13+
terraform.tfstate
14+
terraform.tfstate.backup

devops/.terraform.lock.hcl

+22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

devops/main.tf

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
terraform {
2+
required_providers {
3+
azurerm = {
4+
source = "hashicorp/azurerm"
5+
version = "~>3.110.0"
6+
}
7+
}
8+
9+
# backend "azurerm" {
10+
# resource_group_name = "frontendfestival"
11+
# storage_account_name = "storage-account"
12+
# container_name = "tfstate"
13+
# key = "prod.terraform.tfstate"
14+
# }
15+
}
16+
17+
provider "azurerm" {
18+
skip_provider_registration = true
19+
features {}
20+
}
21+
22+
resource "azurerm_resource_group" "frontendfestival" {
23+
name = "frontendfestival"
24+
location = "westeurope"
25+
tags = {
26+
environment = "production"
27+
source = "Terraform"
28+
contact = "Roderick Huijgen <roderick.huijgen@ordina.nl>"
29+
technical-contact = "Robbin Schepers <robbin.schepers@ordina.nl>"
30+
}
31+
}
32+
33+
resource "azurerm_service_plan" "frontendfestival" {
34+
name = "frontendfestival"
35+
resource_group_name = azurerm_resource_group.frontendfestival.name
36+
location = azurerm_resource_group.frontendfestival.location
37+
os_type = "Linux"
38+
sku_name = "P0v3"
39+
}
40+
41+
resource "azurerm_linux_web_app" "frontendfestival" {
42+
name = "frontendfestival"
43+
resource_group_name = azurerm_resource_group.frontendfestival.name
44+
location = azurerm_service_plan.frontendfestival.location
45+
service_plan_id = azurerm_service_plan.frontendfestival.id
46+
47+
https_only = true
48+
49+
site_config {
50+
always_on = false
51+
http2_enabled = true
52+
53+
application_stack {
54+
node_version = "20-lts"
55+
}
56+
}
57+
}
58+
59+
resource "azurerm_app_service_custom_hostname_binding" "frontendfestival" {
60+
hostname = "frontendfestival.nl"
61+
app_service_name = azurerm_linux_web_app.frontendfestival.name
62+
resource_group_name = azurerm_resource_group.frontendfestival.name
63+
}
64+
65+
resource "azurerm_app_service_managed_certificate" "frontendfestival" {
66+
custom_hostname_binding_id = azurerm_app_service_custom_hostname_binding.frontendfestival.id
67+
}
68+
69+
resource "azurerm_app_service_certificate_binding" "frontendfestival" {
70+
hostname_binding_id = azurerm_app_service_custom_hostname_binding.frontendfestival.id
71+
certificate_id = azurerm_app_service_managed_certificate.frontendfestival.id
72+
ssl_state = "SniEnabled"
73+
}
74+
75+
resource "azurerm_app_service_source_control" "frontendfestival" {
76+
app_id = azurerm_linux_web_app.frontendfestival.id
77+
repo_url = "https://github.com/Ordina-Group/frontendfestival.nl"
78+
branch = "main"
79+
}

0 commit comments

Comments
 (0)