|
| 1 | +locals { |
| 2 | + custom_iglu_resolvers = [ |
| 3 | + { |
| 4 | + name = "Iglu Server" |
| 5 | + priority = 0 |
| 6 | + uri = "${var.iglu_server_dns_name}/api" |
| 7 | + api_key = var.iglu_super_api_key |
| 8 | + vendor_prefixes = [] |
| 9 | + } |
| 10 | + ] |
| 11 | +} |
| 12 | + |
| 13 | +# 1. Deploy PubSub Topics |
| 14 | +module "raw_topic" { |
| 15 | + source = "snowplow-devops/pubsub-topic/google" |
| 16 | + version = "0.1.0" |
| 17 | + |
| 18 | + name = "${var.prefix}-raw-topic" |
| 19 | + |
| 20 | + labels = var.labels |
| 21 | +} |
| 22 | + |
| 23 | +module "bad_1_topic" { |
| 24 | + source = "snowplow-devops/pubsub-topic/google" |
| 25 | + version = "0.1.0" |
| 26 | + |
| 27 | + name = "${var.prefix}-bad-1-topic" |
| 28 | + |
| 29 | + labels = var.labels |
| 30 | +} |
| 31 | + |
| 32 | +module "enriched_topic" { |
| 33 | + source = "snowplow-devops/pubsub-topic/google" |
| 34 | + version = "0.1.0" |
| 35 | + |
| 36 | + name = "${var.prefix}-enriched-topic" |
| 37 | + |
| 38 | + labels = var.labels |
| 39 | +} |
| 40 | + |
| 41 | +# 2. Deploy Collector stack |
| 42 | +module "collector_pubsub" { |
| 43 | + source = "snowplow-devops/collector-pubsub-ce/google" |
| 44 | + version = "0.2.0" |
| 45 | + |
| 46 | + name = "${var.prefix}-collector-server" |
| 47 | + |
| 48 | + network = var.network |
| 49 | + subnetwork = var.subnetwork |
| 50 | + region = var.region |
| 51 | + |
| 52 | + ssh_ip_allowlist = var.ssh_ip_allowlist |
| 53 | + ssh_key_pairs = var.ssh_key_pairs |
| 54 | + |
| 55 | + topic_project_id = var.project_id |
| 56 | + good_topic_name = module.raw_topic.name |
| 57 | + bad_topic_name = module.bad_1_topic.name |
| 58 | + |
| 59 | + telemetry_enabled = var.telemetry_enabled |
| 60 | + user_provided_id = var.user_provided_id |
| 61 | + |
| 62 | + labels = var.labels |
| 63 | +} |
| 64 | + |
| 65 | +module "collector_lb" { |
| 66 | + source = "snowplow-devops/lb/google" |
| 67 | + version = "0.1.0" |
| 68 | + |
| 69 | + name = "${var.prefix}-collector-lb" |
| 70 | + |
| 71 | + instance_group_named_port_http = module.collector_pubsub.named_port_http |
| 72 | + instance_group_url = module.collector_pubsub.instance_group_url |
| 73 | + health_check_self_link = module.collector_pubsub.health_check_self_link |
| 74 | + |
| 75 | + ssl_certificate_enabled = var.ssl_information.enabled |
| 76 | + ssl_certificate_id = var.ssl_information.certificate_id |
| 77 | +} |
| 78 | + |
| 79 | +# 3. Deploy Enrichment |
| 80 | +module "enrich_pubsub" { |
| 81 | + source = "snowplow-devops/enrich-pubsub-ce/google" |
| 82 | + version = "0.1.0" |
| 83 | + |
| 84 | + name = "${var.prefix}-enrich-server" |
| 85 | + |
| 86 | + network = var.network |
| 87 | + subnetwork = var.subnetwork |
| 88 | + region = var.region |
| 89 | + |
| 90 | + ssh_ip_allowlist = var.ssh_ip_allowlist |
| 91 | + ssh_key_pairs = var.ssh_key_pairs |
| 92 | + |
| 93 | + raw_topic_name = module.raw_topic.name |
| 94 | + good_topic_id = module.enriched_topic.id |
| 95 | + bad_topic_id = module.bad_1_topic.id |
| 96 | + |
| 97 | + # Linking in the custom Iglu Server here |
| 98 | + custom_iglu_resolvers = local.custom_iglu_resolvers |
| 99 | + |
| 100 | + telemetry_enabled = var.telemetry_enabled |
| 101 | + user_provided_id = var.user_provided_id |
| 102 | + |
| 103 | + labels = var.labels |
| 104 | +} |
| 105 | + |
| 106 | +# 4. Deploy Postgres Loader |
| 107 | +module "pipeline_db" { |
| 108 | + source = "snowplow-devops/cloud-sql/google" |
| 109 | + version = "0.1.0" |
| 110 | + |
| 111 | + name = "${var.prefix}-pipeline-db" |
| 112 | + |
| 113 | + region = var.region |
| 114 | + db_name = var.pipeline_db_name |
| 115 | + db_username = var.pipeline_db_username |
| 116 | + db_password = var.pipeline_db_password |
| 117 | + |
| 118 | + authorized_networks = var.pipeline_db_authorized_networks |
| 119 | + |
| 120 | + tier = var.pipeline_db_tier |
| 121 | + |
| 122 | + labels = var.labels |
| 123 | +} |
| 124 | + |
| 125 | +module "postgres_loader_enriched" { |
| 126 | + source = "snowplow-devops/postgres-loader-pubsub-ce/google" |
| 127 | + version = "0.2.0" |
| 128 | + |
| 129 | + name = "${var.prefix}-pg-loader-enriched-server" |
| 130 | + |
| 131 | + network = var.network |
| 132 | + subnetwork = var.subnetwork |
| 133 | + region = var.region |
| 134 | + project_id = var.project_id |
| 135 | + |
| 136 | + ssh_ip_allowlist = var.ssh_ip_allowlist |
| 137 | + ssh_key_pairs = var.ssh_key_pairs |
| 138 | + |
| 139 | + in_topic_name = module.enriched_topic.name |
| 140 | + purpose = "ENRICHED_EVENTS" |
| 141 | + schema_name = "atomic" |
| 142 | + |
| 143 | + db_instance_name = module.pipeline_db.connection_name |
| 144 | + db_port = module.pipeline_db.port |
| 145 | + db_name = var.pipeline_db_name |
| 146 | + db_username = var.pipeline_db_username |
| 147 | + db_password = var.pipeline_db_password |
| 148 | + |
| 149 | + # Linking in the custom Iglu Server here |
| 150 | + custom_iglu_resolvers = local.custom_iglu_resolvers |
| 151 | + |
| 152 | + telemetry_enabled = var.telemetry_enabled |
| 153 | + user_provided_id = var.user_provided_id |
| 154 | + |
| 155 | + labels = var.labels |
| 156 | +} |
| 157 | + |
| 158 | +module "postgres_loader_bad" { |
| 159 | + source = "snowplow-devops/postgres-loader-pubsub-ce/google" |
| 160 | + version = "0.2.0" |
| 161 | + |
| 162 | + name = "${var.prefix}-pg-loader-bad-server" |
| 163 | + |
| 164 | + network = var.network |
| 165 | + subnetwork = var.subnetwork |
| 166 | + region = var.region |
| 167 | + project_id = var.project_id |
| 168 | + |
| 169 | + ssh_ip_allowlist = var.ssh_ip_allowlist |
| 170 | + ssh_key_pairs = var.ssh_key_pairs |
| 171 | + |
| 172 | + in_topic_name = module.bad_1_topic.name |
| 173 | + purpose = "JSON" |
| 174 | + schema_name = "atomic_bad" |
| 175 | + |
| 176 | + db_instance_name = module.pipeline_db.connection_name |
| 177 | + db_port = module.pipeline_db.port |
| 178 | + db_name = var.pipeline_db_name |
| 179 | + db_username = var.pipeline_db_username |
| 180 | + db_password = var.pipeline_db_password |
| 181 | + |
| 182 | + # Linking in the custom Iglu Server here |
| 183 | + custom_iglu_resolvers = local.custom_iglu_resolvers |
| 184 | + |
| 185 | + telemetry_enabled = var.telemetry_enabled |
| 186 | + user_provided_id = var.user_provided_id |
| 187 | + |
| 188 | + labels = var.labels |
| 189 | +} |
0 commit comments