Skip to content

Latest commit

 

History

History
127 lines (100 loc) · 2.03 KB

aws_waf_rule.md

File metadata and controls

127 lines (100 loc) · 2.03 KB

aws_waf_rule

back

Index

Terraform

terraform {
  required_providers {
    aws = ">= 3.35.0"
  }
}

top

Example Usage

module "aws_waf_rule" {
  source = "./modules/aws/r/aws_waf_rule"

  # metric_name - (required) is a type of string
  metric_name = null
  # name - (required) is a type of string
  name = null
  # tags - (optional) is a type of map of string
  tags = {}

  predicates = [{
    data_id = null
    negated = null
    type    = null
  }]
}

top

Variables

variable "metric_name" {
  description = "(required)"
  type        = string
}

variable "name" {
  description = "(required)"
  type        = string
}

variable "tags" {
  description = "(optional)"
  type        = map(string)
  default     = null
}

variable "predicates" {
  description = "nested block: NestingSet, min items: 0, max items: 0"
  type = set(object(
    {
      data_id = string
      negated = bool
      type    = string
    }
  ))
  default = []
}

top

Resource

resource "aws_waf_rule" "this" {
  # metric_name - (required) is a type of string
  metric_name = var.metric_name
  # name - (required) is a type of string
  name = var.name
  # tags - (optional) is a type of map of string
  tags = var.tags

  dynamic "predicates" {
    for_each = var.predicates
    content {
      # data_id - (required) is a type of string
      data_id = predicates.value["data_id"]
      # negated - (required) is a type of bool
      negated = predicates.value["negated"]
      # type - (required) is a type of string
      type = predicates.value["type"]
    }
  }

}

top

Outputs

output "arn" {
  description = "returns a string"
  value       = aws_waf_rule.this.arn
}

output "id" {
  description = "returns a string"
  value       = aws_waf_rule.this.id
}

output "this" {
  value = aws_waf_rule.this
}

top