123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- resource "akamai_appsec_configuration" "sec_config" {
- name = "${var.UserID}-apiseclab"
- description = "Security config for API Security lab hostname"
- contract_id = var.contract_id
- group_id = var.group_id
- host_names = ["${var.UserID}-apisecuritylab.com"]
- depends_on = [akamai_property_activation.activation_prod]
- }
-
- output "sec_config_id" {
- value = akamai_appsec_configuration.sec_config.config_id
- }
-
- data "akamai_appsec_configuration" "sec_config" {
- name = "${var.UserID}-apiseclab"
- depends_on = [akamai_appsec_configuration.sec_config]
- }
-
- resource "akamai_appsec_security_policy" "APISecLab" {
- config_id = akamai_appsec_configuration.sec_config.config_id
- default_settings = true
- security_policy_name = "${var.UserID}-APISecLab"
- security_policy_prefix = "0001"
- }
-
- resource "akamai_appsec_match_target" "match_target" {
- config_id = akamai_appsec_configuration.sec_config.config_id
- depends_on = [akamai_appsec_security_policy.APISecLab]
- match_target = <<EOT
- {
- "defaultFile": "NO_MATCH",
- "filePaths": ["/*"],
- "hostnames": ["${var.UserID}-apisecuritylab.com"],
- "securityPolicy": {
- "policyId": "${akamai_appsec_security_policy.APISecLab.security_policy_id}"
- },
- "type": "website"
- }
- EOT
- }
-
- resource "akamai_appsec_activations" "activation" {
- config_id = akamai_appsec_configuration.sec_config.config_id
- network = var.network
- note = "Security Config for API Security lab"
- notification_emails = ["${var.email}"]
- version = data.akamai_appsec_configuration.sec_config.latest_version
- depends_on = [akamai_appsec_match_target.match_target]
- }
-
- data "akamai_appsec_selected_hostnames" "selected_hostnames" {
- config_id = akamai_appsec_configuration.sec_config.config_id
- }
-
- output "selected_hostnames" {
- value = data.akamai_appsec_selected_hostnames.selected_hostnames.output_text
- }
|