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.7KB

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