Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO NOT MERGE YET: Upgrade to TF 1.0.x #107

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions terraform/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.7"
services:
terraform:
image: globalforestwatch/terraform:1.2.2
image: globalforestwatch/terraform:v1.4.2
volumes:
- ../../:/usr/local/src
- $HOME/.aws:/root/.aws:ro
Expand All @@ -13,4 +13,4 @@ services:
- AWS_REGION=us-east-1
- AWS_PROFILE
working_dir: /usr/local/src
entrypoint: infra
entrypoint: infra
38 changes: 23 additions & 15 deletions terraform/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Require TF version to be same as or greater than 0.12.13
terraform {
backend "s3" {
region = "us-east-1"
Expand Down Expand Up @@ -26,15 +25,20 @@ module "vpc" {
module.firewall.default_security_group_id,
module.postgresql.security_group_id,
module.documentdb.security_group_id,
module.redis.security_group_id]
module.redis.security_group_id
]
keys = values(aws_key_pair.all)[*].public_key
// keys = concat(values(aws_key_pair.all)[*].public_key, data.terraform_remote_state.fw_core.outputs.public_keys)
}


module "postgresql" {
source = "./modules/postgresql"
availability_zone_names = [module.vpc.private_subnets[0].availability_zone, module.vpc.private_subnets[1].availability_zone, module.vpc.private_subnets[3].availability_zone]
availability_zone_names = [
module.vpc.private_subnets[0].availability_zone,
module.vpc.private_subnets[1].availability_zone,
module.vpc.private_subnets[3].availability_zone
]
log_retention_period = var.log_retention_period
private_subnet_ids = [module.vpc.private_subnets[0].id, module.vpc.private_subnets[1].id, module.vpc.private_subnets[3].id]
project = var.project_prefix
Expand All @@ -48,7 +52,9 @@ module "postgresql" {
tags = merge(
{
Job = "Geostore",
}, local.tags)
},
local.tags
)
vpc_id = module.vpc.id
rds_password_ro = var.rds_password_ro
rds_port = 5432
Expand All @@ -61,24 +67,26 @@ module "sns" {
tags = merge(
{
Job = "SNS Discovery Topic",
}, local.tags)
},
local.tags
)
}

module "data-lake_bucket" {
source = "git::https://github.com/wri/gfw-terraform-modules.git//terraform/modules/storage?ref=v0.4.0"
source = "git::https://github.com/wri/gfw-terraform-modules.git//terraform/modules/storage?ref=v0.4.5"
bucket_name = "gfw-data-lake${local.bucket_suffix}"
project = var.project_prefix
requester_pays = true
tags = merge({ Job = "Data Lake" }, local.tags)
read_roles = [
jsonencode(formatlist("arn:aws:iam::%s:root", values(var.wri_accounts))),
jsonencode(formatlist("arn:aws:iam::%s:role/core-emr_profile",
matchkeys(values(var.wri_accounts), keys(var.wri_accounts), ["gfw_production", "gfw_staging", "gfw_dev"])))]
jsonencode(formatlist("arn:aws:iam::%s:role/core-emr_profile", matchkeys(values(var.wri_accounts), keys(var.wri_accounts), ["gfw_production", "gfw_staging", "gfw_dev"])))
]
write_policy_prefix = ["", "*/raw/"]
}

module "pipeline_bucket" {
source = "git::https://github.com/wri/gfw-terraform-modules.git//terraform/modules/storage?ref=v0.4.0"
source = "git::https://github.com/wri/gfw-terraform-modules.git//terraform/modules/storage?ref=v0.4.5"
bucket_name = "gfw-pipelines${local.bucket_suffix}"
project = var.project_prefix
requester_pays = false
Expand Down Expand Up @@ -119,7 +127,7 @@ module "pipeline_bucket" {

module "data-lake-test-bucket" {
count = var.environment == "dev" ? 1 : 0
source = "git::https://github.com/wri/gfw-terraform-modules.git//terraform/modules/storage?ref=v0.4.0"
source = "git::https://github.com/wri/gfw-terraform-modules.git//terraform/modules/storage?ref=v0.4.5"
bucket_name = "gfw-data-lake-test"
requester_pays = true
project = var.project_prefix
Expand All @@ -129,7 +137,7 @@ module "data-lake-test-bucket" {

module "pipeline-test-bucket" {
count = var.environment == "dev" ? 1 : 0
source = "git::https://github.com/wri/gfw-terraform-modules.git//terraform/modules/storage?ref=v0.4.0"
source = "git::https://github.com/wri/gfw-terraform-modules.git//terraform/modules/storage?ref=v0.4.5"
bucket_name = "gfw-pipelines-test"
requester_pays = false
project = var.project_prefix
Expand All @@ -147,29 +155,29 @@ module "firewall" {
}

module "api_token_secret" {
source = "git::https://github.com/wri/gfw-terraform-modules.git//terraform/modules/secrets?ref=v0.4.0"
source = "git::https://github.com/wri/gfw-terraform-modules.git//terraform/modules/secrets?ref=v0.4.5"
project = var.project_prefix
name = "gfw-api/token"
secret_string = jsonencode({ "token" = var.gfw_api_token, "email" = "gfw-sync@wri.org" })
}


module "slack_secret" {
source = "git::https://github.com/wri/gfw-terraform-modules.git//terraform/modules/secrets?ref=v0.4.0"
source = "git::https://github.com/wri/gfw-terraform-modules.git//terraform/modules/secrets?ref=v0.4.5"
project = var.project_prefix
name = "slack/gfw-sync"
secret_string = jsonencode({ "data-updates" = var.slack_data_updates_hook })
}

module "gcs_gfw_gee_export_secret" {
source = "git::https://github.com/wri/gfw-terraform-modules.git//terraform/modules/secrets?ref=v0.4.0"
source = "git::https://github.com/wri/gfw-terraform-modules.git//terraform/modules/secrets?ref=v0.4.5"
project = var.project_prefix
name = "gcs/gfw-gee-export"
secret_string = var.gfw-gee-export_key
}

module "planet_api_key_secret" {
source = "git::https://github.com/wri/gfw-terraform-modules.git//terraform/modules/secrets?ref=v0.4.0"
source = "git::https://github.com/wri/gfw-terraform-modules.git//terraform/modules/secrets?ref=v0.4.5"
project = var.project_prefix
name = "planet/api_key"
secret_string = var.planet_api_key
Expand Down
4 changes: 2 additions & 2 deletions terraform/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 2.56, < 4.0"
version = ">= 4, < 5"
region = "us-east-1"
}
local = {
Expand All @@ -13,4 +13,4 @@ terraform {
}
}
required_version = ">= 0.13"
}
}