devops0776 10 месяцев назад
Родитель
Сommit
ad0d984f34
4 измененных файлов: 135 добавлений и 0 удалений
  1. 21
    0
      akamai.tf
  2. 63
    0
      configuration.tf
  3. 2
    0
      terraform.tfvars
  4. 49
    0
      variables.tf

+ 21
- 0
akamai.tf Просмотреть файл

@@ -0,0 +1,21 @@
terraform {
backend "s3" {
bucket = "akau-devops"
key = "<UserID>-zerotohero.tfstate"
region = "us-mia-1"
endpoint = "us-mia-1.linodeobjects.com"
skip_credentials_validation = true
skip_region_validation = true
}
required_providers {
akamai = {
source = "akamai/akamai"
version = "5.2.0"
}
}
}
provider "akamai" {
edgerc = var.edgerc
config_section = var.section
}

+ 63
- 0
configuration.tf Просмотреть файл

@@ -0,0 +1,63 @@
data "akamai_property_rules_template" "rules-template" {
template_file = abspath("${path.root}/property-snippets/main.json")
variables {
name = "secure"
value = "${var.secure}"
type = "bool"
}
variables {
name = "origin_hostname"
value = "${var.origin_hostname}"
type = "string"
}
variables {
name = "cp_code_id"
value = "${var.cp_code_id}"
type = "number"
}
variables {
name = "UserID"
value = "${var.UserID}"
type = "string"
}
variables {
name = "labname"
value = "${var.labname}"
type = "string"
}
}

resource "akamai_property" "lab_property" {
name = "${var.UserID}-${var.labname}"
product_id = "prd_SPM"
contract_id = "ctr_${var.contract_id}"
group_id = "grp_${var.group_id}"
hostnames {
cname_from = "${var.UserID}${var.labname}.${var.hostname}"
cname_to = var.edge_hostname
cert_provisioning_type = "CPS_MANAGED"
}
hostnames {
cname_from = "${var.UserID}${var.labname}-test.${var.hostname}"
cname_to = var.edge_hostname
cert_provisioning_type = "CPS_MANAGED"
}
rule_format = "latest"
rules = data.akamai_property_rules_template.rules-template.json
}

output "property_id" {
value = "${akamai_property.lab_property.id}"
}
output "property_version" {
value = "${akamai_property.lab_property.latest_version}"
}

resource "akamai_property_activation" "activation_staging" {
property_id = "${akamai_property.lab_property.id}"
version = "${akamai_property.lab_property.latest_version}"
network = "${var.network}"
contact = ["${var.email}"]
note = "Terraform property creation lab"
auto_acknowledge_rule_warnings = true
}

+ 2
- 0
terraform.tfvars Просмотреть файл

@@ -0,0 +1,2 @@
UserID = "<UserID>"
email = "<Email>"

+ 49
- 0
variables.tf Просмотреть файл

@@ -0,0 +1,49 @@
variable "edgerc" {
type = string
default = "~/.edgerc"
}
variable "section" {
type = string
default = "default"
}
variable "UserID" {
type = string
}
variable "contract_id" {
type = string
default = "W-KXID8R"
}
variable "group_id" {
type = string
default = "240886"
}
variable "origin_hostname" {
type = string
default = "juiceshopdevops.akaorigin.com"
}
variable "cp_code_id" {
type = number
default = 1523912
}
variable "secure" {
type = bool
default = true
}
variable "network" {
default = "STAGING"
}
variable "hostname" {
type = string
default = "akaudevops.com"
}
variable "edge_hostname" {
type = string
default = "akaudevops.com.edgekey.net"
}
variable "labname" {
type = string
default = "cicdlab"
}
variable "email" {
type = string
}

Загрузка…
Отмена
Сохранить