Skip to content

Commit c6b719a

Browse files
authored
Merge pull request #143 from wri/develop
Merge private subnet changes up
2 parents 99d3b8a + 9510feb commit c6b719a

File tree

7 files changed

+17
-10
lines changed

7 files changed

+17
-10
lines changed

src/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ RUN pip install . -t python
1515
# to change the hash of the file and get TF to realize it needs to be
1616
# redeployed. Ticket for a better solution:
1717
# https://gfw.atlassian.net/browse/GTC-1250
18-
# change 2
18+
# change 3
1919

2020
RUN yum install -y zip geos-devel
2121

src/datapump/globals.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class Globals(EnvSettings):
3030
s3_bucket_data_lake: str = Field(env="S3_BUCKET_DATA_LAKE")
3131
s3_glad_path: Optional[str] = Field(env="S3_GLAD_PATH")
3232
ec2_key_name: Optional[str] = Field("", env="EC2_KEY_NAME")
33-
public_subnet_ids: List[str] = Field(
34-
json.loads(os.environ.get("PUBLIC_SUBNET_IDS", b"[]"))
33+
subnet_ids: List[str] = Field(
34+
json.loads(os.environ.get("SUBNET_IDS", b"[]"))
3535
)
3636
emr_instance_profile: Optional[str] = Field("", env="EMR_INSTANCE_PROFILE")
3737
emr_service_role: Optional[str] = Field("", env="EMR_SERVICE_ROLE")

src/datapump/jobs/geotrellis.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -908,8 +908,8 @@ def _instances(worker_count: int) -> Dict[str, Any]:
908908
if GLOBALS.ec2_key_name:
909909
instances["Ec2KeyName"] = GLOBALS.ec2_key_name
910910

911-
if GLOBALS.public_subnet_ids:
912-
instances["Ec2SubnetIds"] = GLOBALS.public_subnet_ids
911+
if GLOBALS.subnet_ids:
912+
instances["Ec2SubnetIds"] = GLOBALS.subnet_ids
913913

914914
return instances
915915

terraform/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ module "datapump" {
5454
glad_path = local.glad_path
5555
emr_instance_profile_name = data.terraform_remote_state.core.outputs.emr_instance_profile_name
5656
emr_service_role_name = data.terraform_remote_state.core.outputs.emr_service_role_name
57-
public_subnet_ids = data.terraform_remote_state.core.outputs.public_subnet_ids
57+
subnet_ids = data.terraform_remote_state.core.outputs.private_subnet_ids
5858
ec2_key_name = data.terraform_remote_state.core.outputs.key_pair_jterry_gfw
5959
gcs_secret_arn = data.terraform_remote_state.core.outputs.secrets_read-gfw-gee-export_arn
6060
read_gfw_api_secrets_policy = data.terraform_remote_state.core.outputs.secrets_read-gfw-api-token_policy_arn

terraform/modules/datapump/cloudwatch.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ resource "aws_cloudwatch_event_rule" "everyday-11-pm-est" {
55
tags = local.tags
66
}
77

8+
resource "aws_cloudwatch_event_rule" "everyday-10-pm-est" {
9+
name = substr("everyday-10-pm-est${local.name_suffix}", 0, 64)
10+
description = "Run everyday at 10 pm EST"
11+
schedule_expression = "cron(0 6 ? * * *)"
12+
tags = local.tags
13+
}
14+
815
resource "aws_cloudwatch_event_rule" "everyday-7-pm-est" {
916
name = substr("everyday-7-pm-est${local.name_suffix}", 0, 64)
1017
description = "Run everyday at 7 pm EST"
@@ -38,7 +45,7 @@ resource "aws_cloudwatch_event_target" "sync-deforestation-alerts" {
3845
}
3946

4047
resource "aws_cloudwatch_event_target" "sync-glad" {
41-
rule = aws_cloudwatch_event_rule.everyday-11-pm-est.name
48+
rule = aws_cloudwatch_event_rule.everyday-10-pm-est.name
4249
target_id = substr("${local.project}-sync-glad${local.name_suffix}", 0, 64)
4350
arn = aws_sfn_state_machine.datapump.id
4451
input = "{\"command\": \"sync\", \"parameters\": {\"types\": [\"glad\"]}}"

terraform/modules/datapump/lambdas.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ resource "aws_lambda_function" "executor" {
4545
S3_BUCKET_PIPELINE = var.pipelines_bucket
4646
S3_BUCKET_DATA_LAKE = var.data_lake_bucket
4747
GEOTRELLIS_JAR_PATH = var.geotrellis_jar_path
48-
PUBLIC_SUBNET_IDS = jsonencode(var.public_subnet_ids)
48+
SUBNET_IDS = jsonencode(var.subnet_ids)
4949
EC2_KEY_NAME = var.ec2_key_name
5050
EMR_SERVICE_ROLE = var.emr_service_role_name
5151
EMR_INSTANCE_PROFILE = var.emr_instance_profile_name

terraform/modules/datapump/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ variable "ec2_key_name" {
6565
description = "Key pair to use for SSHing into EC2"
6666
}
6767

68-
variable "public_subnet_ids" {
68+
variable "subnet_ids" {
6969
default = []
7070
type = list(string)
71-
description = "Public subnet IDs to run on"
71+
description = "Subnet IDs to run on"
7272
}
7373

7474
variable "pipelines_bucket" {

0 commit comments

Comments
 (0)