Merge pull request #1266 from robgil-dds/169163334-cdn

169163334 - Adds CDN module
This commit is contained in:
dandds 2019-12-19 09:39:28 -05:00 committed by GitHub
commit fb1b6ddfe4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 100 additions and 30 deletions

View 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
}
}

View File

View 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"
}

View File

@ -15,10 +15,10 @@ resource "azurerm_redis_cache" "redis" {
minimum_tls_version = var.minimum_tls_version minimum_tls_version = var.minimum_tls_version
redis_configuration { redis_configuration {
enable_authentication = var.enable_authentication enable_authentication = var.enable_authentication
} }
tags = { tags = {
environment = var.environment environment = var.environment
owner = var.owner owner = var.owner
} }
} }

View File

@ -19,42 +19,42 @@ variable "owner" {
} }
variable "capacity" { variable "capacity" {
type = string type = string
default = 2 default = 2
description = "The capacity of the redis cache" description = "The capacity of the redis cache"
} }
variable "family" { variable "family" {
type = string type = string
default = "C" default = "C"
description = "The subscription family for redis" description = "The subscription family for redis"
} }
variable "sku_name" { variable "sku_name" {
type = string type = string
default = "Standard" default = "Standard"
description = "The sku to use" description = "The sku to use"
} }
variable "enable_non_ssl_port" { variable "enable_non_ssl_port" {
type = bool type = bool
default = false default = false
description = "Enable non TLS port (default: false)" description = "Enable non TLS port (default: false)"
} }
variable "minimum_tls_version" { variable "minimum_tls_version" {
type = string type = string
default = "1.2" default = "1.2"
description = "Minimum TLS version to use" description = "Minimum TLS version to use"
} }
variable "enable_authentication" { variable "enable_authentication" {
type = bool type = bool
default = true default = true
description = "Enable or disable authentication (default: true)" description = "Enable or disable authentication (default: true)"
} }

View 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
}

View File

@ -1,7 +1,7 @@
module "redis" { module "redis" {
source = "../../modules/redis" source = "../../modules/redis"
owner = var.owner owner = var.owner
environment = var.environment environment = var.environment
region = var.region region = var.region
name = var.name name = var.name
} }