Skip to content
Merged
3 changes: 3 additions & 0 deletions terraform/data.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
data "aws_ssm_parameter" "core_contract" {
name = "/infra/${var.environment}/gfw-aws-core-infra/contract"
}
3 changes: 1 addition & 2 deletions terraform/locals.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
locals {
bucket_suffix = var.environment == "production" ? "" : "-${var.environment}"
tf_state_bucket = "gfw-terraform${local.bucket_suffix}"
project = "lambda-layers"
name_suffix = terraform.workspace == "default" ? "" : "-${terraform.workspace}"
tags = {
Project = var.project,
Environment = var.environment,
BuiltBy = "Terraform"
}
core = jsondecode(data.aws_ssm_parameter.core_contract.value)
}
35 changes: 13 additions & 22 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,9 @@ terraform {
}
}

data "terraform_remote_state" "core" {
backend = "s3"
config = {
bucket = local.tf_state_bucket
region = "us-east-1"
key = "core.tfstate"
}
}

module "py310_geopandas_0144" {
source = "./modules/lambda_layer"
bucket = data.terraform_remote_state.core.outputs.pipelines_bucket
bucket = local.core.gfw_pipelines_bucket_name
name = "geopandas"
module_version = "0.14.4"
runtime = "python3.10"
Expand All @@ -27,7 +18,7 @@ module "py310_geopandas_0144" {

module "py310_mercantile_121" {
source = "./modules/lambda_layer"
bucket = data.terraform_remote_state.core.outputs.pipelines_bucket
bucket = local.core.gfw_pipelines_bucket_name
name = "mercantile"
module_version = "1.2.1"
runtime = "python3.10"
Expand All @@ -36,7 +27,7 @@ module "py310_mercantile_121" {

module "py310_numpy_1264" {
source = "./modules/lambda_layer"
bucket = data.terraform_remote_state.core.outputs.pipelines_bucket
bucket = local.core.gfw_pipelines_bucket_name
name = "numpy"
module_version = "1.26.4"
runtime = "python3.10"
Expand All @@ -45,7 +36,7 @@ module "py310_numpy_1264" {

module "py310_pandas_153" {
source = "./modules/lambda_layer"
bucket = data.terraform_remote_state.core.outputs.pipelines_bucket
bucket = local.core.gfw_pipelines_bucket_name
name = "pandas"
module_version = "1.5.3"
runtime = "python3.10"
Expand All @@ -54,7 +45,7 @@ module "py310_pandas_153" {

module "py310_pillow_950" {
source = "./modules/lambda_layer"
bucket = data.terraform_remote_state.core.outputs.pipelines_bucket
bucket = local.core.gfw_pipelines_bucket_name
name = "pillow"
module_version = "9.5.0"
runtime = "python3.10"
Expand All @@ -63,7 +54,7 @@ module "py310_pillow_950" {

module "py310_rasterio_138" {
source = "./modules/lambda_layer"
bucket = data.terraform_remote_state.core.outputs.pipelines_bucket
bucket = local.core.gfw_pipelines_bucket_name
name = "rasterio"
module_version = "1.3.8"
runtime = "python3.10"
Expand All @@ -72,7 +63,7 @@ module "py310_rasterio_138" {

module "py310_shapely_185" {
source = "./modules/lambda_layer"
bucket = data.terraform_remote_state.core.outputs.pipelines_bucket
bucket = local.core.gfw_pipelines_bucket_name
name = "shapely"
module_version = "1.8.5"
runtime = "python3.10"
Expand All @@ -83,7 +74,7 @@ module "py310_shapely_185" {
# These are temporary:
module "py310_geopandas_no_numpy_no_pandas" {
source = "./modules/lambda_layer"
bucket = data.terraform_remote_state.core.outputs.pipelines_bucket
bucket = local.core.gfw_pipelines_bucket_name
name = "geopandas_no_numpy_no_pandas"
module_version = "0.14.4"
runtime = "python3.10"
Expand All @@ -92,7 +83,7 @@ module "py310_geopandas_no_numpy_no_pandas" {

module "py310_numpy" {
source = "./modules/lambda_layer"
bucket = data.terraform_remote_state.core.outputs.pipelines_bucket
bucket = local.core.gfw_pipelines_bucket_name
name = "numpy"
module_version = "1.26.4"
runtime = "python3.10"
Expand All @@ -101,7 +92,7 @@ module "py310_numpy" {

module "py310_pandas_no_numpy" {
source = "./modules/lambda_layer"
bucket = data.terraform_remote_state.core.outputs.pipelines_bucket
bucket = local.core.gfw_pipelines_bucket_name
name = "pandas_no_numpy"
module_version = "1.5.3"
runtime = "python3.10"
Expand All @@ -110,7 +101,7 @@ module "py310_pandas_no_numpy" {

module "py310_rasterio_no_numpy" {
source = "./modules/lambda_layer"
bucket = data.terraform_remote_state.core.outputs.pipelines_bucket
bucket = local.core.gfw_pipelines_bucket_name
name = "rasterio_no_numpy"
module_version = "1.3.8"
runtime = "python3.10"
Expand All @@ -119,7 +110,7 @@ module "py310_rasterio_no_numpy" {

module "py310_shapely_no_numpy" {
source = "./modules/lambda_layer"
bucket = data.terraform_remote_state.core.outputs.pipelines_bucket
bucket = local.core.gfw_pipelines_bucket_name
name = "shapely_no_numpy"
module_version = "1.8.5"
runtime = "python3.10"
Expand All @@ -128,7 +119,7 @@ module "py310_shapely_no_numpy" {
}

module "ssm" {
source = "git::https://github.com/wri/gfw-terraform-modules.git//terraform/modules/ssm?ref=v0.4.2.8"
source = "git::https://github.com/wri/gfw-terraform-modules.git//terraform/modules/ssm?ref=v0.4.2.12"
environment = var.environment
namespace = "gfw-lambda-layers"
contract = {
Expand Down