adding skeleton infrastructure for web and data
This commit is contained in:
commit
a7601bf3af
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
.terraform
|
||||
.terraform*
|
||||
|
||||
*.tfstate*
|
||||
|
||||
terraform.tfvars
|
5
README.md
Normal file
5
README.md
Normal file
@ -0,0 +1,5 @@
|
||||
Selector Infra
|
||||
====================
|
||||
|
||||
Terraform IaC for [Selector](https://selector.sarsoo.xyz).
|
||||
Each environment requires credentials in text variable format as `terraform.tfvars` in each folder.
|
42
modules/data/main.tf
Normal file
42
modules/data/main.tf
Normal file
@ -0,0 +1,42 @@
|
||||
resource "azurerm_postgresql_server" "selector" {
|
||||
name = var.data_name
|
||||
location = var.resource_group_location
|
||||
resource_group_name = var.resource_group_name
|
||||
|
||||
administrator_login = "psqladmin"
|
||||
administrator_login_password = "H@Sh1CoR3!"
|
||||
|
||||
sku_name = "B_Gen5_1"
|
||||
version = "11"
|
||||
# storage_mb = 640000
|
||||
|
||||
backup_retention_days = 7
|
||||
# geo_redundant_backup_enabled = false
|
||||
# auto_grow_enabled = false
|
||||
|
||||
# public_network_access_enabled = false
|
||||
ssl_enforcement_enabled = true
|
||||
ssl_minimal_tls_version_enforced = "TLS1_2"
|
||||
}
|
||||
|
||||
resource "azurerm_postgresql_database" "selector" {
|
||||
charset = "UTF8"
|
||||
collation = "en-GB"
|
||||
name = var.data_name
|
||||
resource_group_name = var.resource_group_name
|
||||
server_name = azurerm_postgresql_server.selector.name
|
||||
}
|
||||
|
||||
resource "azurerm_redis_cache" "selector" {
|
||||
name = var.data_name
|
||||
location = var.resource_group_location
|
||||
resource_group_name = var.resource_group_name
|
||||
capacity = 1
|
||||
family = "C"
|
||||
sku_name = "Standard"
|
||||
enable_non_ssl_port = false
|
||||
minimum_tls_version = "1.2"
|
||||
|
||||
redis_configuration {
|
||||
}
|
||||
}
|
0
modules/data/outputs.tf
Normal file
0
modules/data/outputs.tf
Normal file
11
modules/data/variables.tf
Normal file
11
modules/data/variables.tf
Normal file
@ -0,0 +1,11 @@
|
||||
variable "resource_group_name" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "resource_group_location" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "data_name" {
|
||||
type = string
|
||||
}
|
18
modules/web_service/main.tf
Normal file
18
modules/web_service/main.tf
Normal file
@ -0,0 +1,18 @@
|
||||
resource "azurerm_service_plan" "selector" {
|
||||
name = var.site_name
|
||||
resource_group_name = var.resource_group_name
|
||||
location = var.resource_group_location
|
||||
os_type = "Linux"
|
||||
sku_name = "F1"
|
||||
}
|
||||
|
||||
resource "azurerm_linux_web_app" "example" {
|
||||
name = var.site_name
|
||||
resource_group_name = var.resource_group_name
|
||||
location = azurerm_service_plan.selector.location
|
||||
service_plan_id = azurerm_service_plan.selector.id
|
||||
|
||||
site_config {
|
||||
always_on = false
|
||||
}
|
||||
}
|
0
modules/web_service/outputs.tf
Normal file
0
modules/web_service/outputs.tf
Normal file
11
modules/web_service/variables.tf
Normal file
11
modules/web_service/variables.tf
Normal file
@ -0,0 +1,11 @@
|
||||
variable "resource_group_name" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "resource_group_location" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "site_name" {
|
||||
type = string
|
||||
}
|
44
prod/main.tf
Normal file
44
prod/main.tf
Normal file
@ -0,0 +1,44 @@
|
||||
terraform {
|
||||
backend "local" {}
|
||||
|
||||
required_providers {
|
||||
azurerm = {
|
||||
source = "hashicorp/azurerm"
|
||||
version = "3.71.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "azurerm" {
|
||||
features {}
|
||||
|
||||
subscription_id = var.azure_subscription_id
|
||||
client_id = var.azure_client_id
|
||||
client_secret = var.azure_client_secret
|
||||
tenant_id = var.azure_tenant_id
|
||||
}
|
||||
|
||||
locals {
|
||||
env_name = "selector-prod"
|
||||
}
|
||||
|
||||
resource "azurerm_resource_group" "selector" {
|
||||
name = local.env_name
|
||||
location = "UK South"
|
||||
}
|
||||
|
||||
# module "web_service" {
|
||||
# source = "../modules/web_service"
|
||||
|
||||
# resource_group_name = azurerm_resource_group.selector.name
|
||||
# resource_group_location = azurerm_resource_group.selector.location
|
||||
# site_name = "${local.env_name}-web"
|
||||
# }
|
||||
|
||||
# module "data" {
|
||||
# source = "../modules/data"
|
||||
|
||||
# resource_group_name = azurerm_resource_group.selector.name
|
||||
# resource_group_location = azurerm_resource_group.selector.location
|
||||
# data_name = "${local.env_name}-data"
|
||||
# }
|
0
prod/outputs.tf
Normal file
0
prod/outputs.tf
Normal file
19
prod/variables.tf
Normal file
19
prod/variables.tf
Normal file
@ -0,0 +1,19 @@
|
||||
variable "azure_subscription_id" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "azure_client_id" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "azure_client_secret" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "azure_tenant_id" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "azure_admin_password" {
|
||||
type = string
|
||||
}
|
Loading…
Reference in New Issue
Block a user