Merge pull request #1266 from robgil-dds/169163334-cdn
169163334 - Adds CDN module
This commit is contained in:
commit
fb1b6ddfe4
31
terraform/modules/cdn/main.tf
Normal file
31
terraform/modules/cdn/main.tf
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
resource "random_id" "server" {
|
||||||
|
keepers = {
|
||||||
|
azi_id = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
byte_length = 8
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "azurerm_resource_group" "cdn" {
|
||||||
|
name = "${var.name}-${var.environment}-cdn"
|
||||||
|
location = var.region
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "azurerm_cdn_profile" "cdn" {
|
||||||
|
name = "${var.name}-${var.environment}-profile"
|
||||||
|
location = azurerm_resource_group.cdn.location
|
||||||
|
resource_group_name = azurerm_resource_group.cdn.name
|
||||||
|
sku = var.sku
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "azurerm_cdn_endpoint" "cdn" {
|
||||||
|
name = "${var.name}-${var.environment}-${random_id.server.hex}"
|
||||||
|
profile_name = azurerm_cdn_profile.cdn.name
|
||||||
|
location = azurerm_resource_group.cdn.location
|
||||||
|
resource_group_name = azurerm_resource_group.cdn.name
|
||||||
|
|
||||||
|
origin {
|
||||||
|
name = "${var.name}-${var.environment}-origin"
|
||||||
|
host_name = var.origin_host_name
|
||||||
|
}
|
||||||
|
}
|
0
terraform/modules/cdn/outputs.tf
Normal file
0
terraform/modules/cdn/outputs.tf
Normal file
31
terraform/modules/cdn/variables.tf
Normal file
31
terraform/modules/cdn/variables.tf
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
variable "region" {
|
||||||
|
type = string
|
||||||
|
description = "Region this module and resources will be created in"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "name" {
|
||||||
|
type = string
|
||||||
|
description = "Unique name for the services in this module"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "environment" {
|
||||||
|
type = string
|
||||||
|
description = "Environment these resources reside (prod, dev, staging, etc)"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "owner" {
|
||||||
|
type = string
|
||||||
|
description = "Owner of the environment and resources created in this module"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "sku" {
|
||||||
|
type = string
|
||||||
|
description = "SKU of which CDN to use"
|
||||||
|
default = "Standard_Verizon"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "origin_host_name" {
|
||||||
|
type = string
|
||||||
|
description = "Subdomain to use for the origin in requests to the CDN"
|
||||||
|
}
|
||||||
|
|
8
terraform/providers/dev/cdn.tf
Normal file
8
terraform/providers/dev/cdn.tf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
module "cdn" {
|
||||||
|
source = "../../modules/cdn"
|
||||||
|
origin_host_name = "staging.atat.code.mil"
|
||||||
|
owner = var.owner
|
||||||
|
environment = var.environment
|
||||||
|
name = var.name
|
||||||
|
region = var.region
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user