main.tf 1.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
// Configure remote state
terraform {
  backend "s3" {}
}

// Use credentials from environment or shared credentials file
provider "aws" {
  region  = "us-east-1"
  version = "~> 1.41"
}

12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
// VPC
resource "aws_vpc" "snowplow_vpc" {
  cidr_block       = "10.32.0.0/16"
  tags = {
    Name = "SnowPlow VPC"
    environment = "SnowPlow"
  }
}

// Subnet
resource "aws_subnet" "snowplow_subnet" {
  vpc_id     = "${aws_vpc.snowplow_vpc.id}"
  cidr_block = "10.32.0.0/24"

  tags = {
    Name = "SnowPlow Subnet"
    environment = "SnowPlow"
  }
}

// ECR SnowPlow Collector Repository
resource "aws_ecr_repository" "snowplow_ecr_collector_repo" {
  name = "SnowPlow Collector"
  tags = {
    environment = "SnowPlow"
  }
}

resource "aws_ecr_repository" "snowplow_ecr_enricher_repo" {
  name = "SnowPlow Enricher"
42 43 44 45 46 47 48 49 50 51 52 53
  tags = {
    environment = "SnowPlow"
  }
}

// ECS Cluster
resource "aws_ecs_cluster" "snowplow_ecs_cluster" {
  name = "SnowPlow"
  tags = {
    environment = "SnowPlow"
  }
}
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84

// Kinesis Streams
resource "aws_kinesis_stream" "snowplow_good_stream" {
  name             = "SnowPlow-Good-Stream"
  shard_count      = 1
  retention_period = 48

  shard_level_metrics = [
    "IncomingBytes",
    "OutgoingBytes",
  ]

  tags = {
    environment = "SnowPlow"
  }
}

resource "aws_kinesis_stream" "snowplow_bad_stream" {
  name             = "SnowPlow-Bad-Stream"
  shard_count      = 1
  retention_period = 48

  shard_level_metrics = [
    "IncomingBytes",
    "OutgoingBytes",
  ]

  tags = {
    environment = "SnowPlow"
  }
}