You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

security.tf 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. resource "akamai_appsec_configuration" "sec_config" {
  2. name = "${var.UserID}-apiseclab"
  3. description = "Security config for API Security lab hostname"
  4. contract_id = var.contract_id
  5. group_id = var.group_id
  6. host_names = ["${var.UserID}-apisecuritylab.com"]
  7. depends_on = [akamai_property_activation.activation_prod]
  8. }
  9. output "sec_config_id" {
  10. value = akamai_appsec_configuration.sec_config.config_id
  11. }
  12. data "akamai_appsec_configuration" "sec_config" {
  13. name = "${var.UserID}-apiseclab"
  14. depends_on = [akamai_appsec_configuration.sec_config]
  15. }
  16. resource "akamai_appsec_security_policy" "APISecLab" {
  17. config_id = akamai_appsec_configuration.sec_config.config_id
  18. default_settings = true
  19. security_policy_name = "${var.UserID}-APISecLab"
  20. security_policy_prefix = "0001"
  21. }
  22. resource "akamai_appsec_match_target" "match_target" {
  23. config_id = akamai_appsec_configuration.sec_config.config_id
  24. depends_on = [akamai_appsec_security_policy.APISecLab]
  25. match_target = <<EOT
  26. {
  27. "defaultFile": "NO_MATCH",
  28. "filePaths": ["/*"],
  29. "hostnames": ["${var.UserID}-apisecuritylab.com"],
  30. "securityPolicy": {
  31. "policyId": "${akamai_appsec_security_policy.APISecLab.security_policy_id}"
  32. },
  33. "type": "website"
  34. }
  35. EOT
  36. }
  37. resource "akamai_appsec_activations" "activation" {
  38. config_id = akamai_appsec_configuration.sec_config.config_id
  39. network = var.network
  40. note = "Security Config for API Security lab"
  41. notification_emails = ["${var.email}"]
  42. version = data.akamai_appsec_configuration.sec_config.latest_version
  43. depends_on = [akamai_appsec_match_target.match_target]
  44. }
  45. data "akamai_appsec_selected_hostnames" "selected_hostnames" {
  46. config_id = akamai_appsec_configuration.sec_config.config_id
  47. }
  48. output "selected_hostnames" {
  49. value = data.akamai_appsec_selected_hostnames.selected_hostnames.output_text
  50. }