github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/e2e/terraform/network.tf (about)

     1  data "aws_vpc" "default" {
     2    default = true
     3  }
     4  
     5  data "aws_subnet" "default" {
     6    availability_zone = var.availability_zone
     7    vpc_id            = data.aws_vpc.default.id
     8  }
     9  
    10  resource "aws_security_group" "primary" {
    11    name   = local.random_name
    12    vpc_id = data.aws_vpc.default.id
    13  
    14    ingress {
    15      from_port   = 22
    16      to_port     = 22
    17      protocol    = "tcp"
    18      cidr_blocks = ["0.0.0.0/0"]
    19    }
    20  
    21    # Nomad
    22    ingress {
    23      from_port   = 4646
    24      to_port     = 4646
    25      protocol    = "tcp"
    26      cidr_blocks = ["0.0.0.0/0"]
    27    }
    28  
    29    # Fabio
    30    ingress {
    31      from_port   = 9998
    32      to_port     = 9999
    33      protocol    = "tcp"
    34      cidr_blocks = ["0.0.0.0/0"]
    35    }
    36  
    37    # Consul
    38    ingress {
    39      from_port   = 8500
    40      to_port     = 8500
    41      protocol    = "tcp"
    42      cidr_blocks = ["0.0.0.0/0"]
    43    }
    44  
    45    # Vault
    46    ingress {
    47      from_port   = 8200
    48      to_port     = 8200
    49      protocol    = "tcp"
    50      cidr_blocks = ["0.0.0.0/0"]
    51    }
    52  
    53    # HDFS NameNode UI
    54    ingress {
    55      from_port   = 50070
    56      to_port     = 50070
    57      protocol    = "tcp"
    58      cidr_blocks = ["0.0.0.0/0"]
    59    }
    60  
    61    # HDFS DataNode UI
    62    ingress {
    63      from_port   = 50075
    64      to_port     = 50075
    65      protocol    = "tcp"
    66      cidr_blocks = ["0.0.0.0/0"]
    67    }
    68  
    69    # Spark history server UI
    70    ingress {
    71      from_port   = 18080
    72      to_port     = 18080
    73      protocol    = "tcp"
    74      cidr_blocks = ["0.0.0.0/0"]
    75    }
    76  
    77    ingress {
    78      from_port = 0
    79      to_port   = 0
    80      protocol  = "-1"
    81      self      = true
    82    }
    83  
    84    egress {
    85      from_port   = 0
    86      to_port     = 0
    87      protocol    = "-1"
    88      cidr_blocks = ["0.0.0.0/0"]
    89    }
    90  }
    91  
    92  resource "aws_security_group" "nfs" {
    93    count  = var.volumes ? 1 : 0
    94    name   = "${local.random_name}-nfs"
    95    vpc_id = data.aws_vpc.default.id
    96  
    97    ingress {
    98      from_port       = 2049
    99      to_port         = 2049
   100      protocol        = "tcp"
   101      security_groups = [aws_security_group.primary.id]
   102    }
   103  }