Skip to content

Commit e19b114

Browse files
committed
fix tf apply errors
1 parent 60f2e03 commit e19b114

4 files changed

+69
-4
lines changed

catalogue_graph/terraform/iam_state_machines.tf

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ resource "aws_iam_role" "state_machine_execution_role" {
88
{
99
Effect = "Allow",
1010
Principal = {
11-
Service = "states.amazonaws.com"
11+
Service = [
12+
"states.amazonaws.com",
13+
"scheduler.amazonaws.com"
14+
]
1215
},
1316
Action = "sts:AssumeRole"
1417
}
@@ -31,8 +34,12 @@ resource "aws_iam_policy" "state_machine_policy" {
3134
Resource = [
3235
aws_sfn_state_machine.catalogue_graph_extractor.arn,
3336
aws_sfn_state_machine.catalogue_graph_extractors.arn,
37+
aws_sfn_state_machine.catalogue_graph_extractors_monthly.arn,
38+
aws_sfn_state_machine.catalogue_graph_extractors_daily.arn,
3439
aws_sfn_state_machine.catalogue_graph_bulk_loader.arn,
3540
aws_sfn_state_machine.catalogue_graph_bulk_loaders.arn,
41+
aws_sfn_state_machine.catalogue_graph_bulk_loaders_monthly.arn,
42+
aws_sfn_state_machine.catalogue_graph_bulk_loaders_daily.arn,
3643
aws_sfn_state_machine.catalogue_graph_ingestor.arn,
3744
aws_sfn_state_machine.concepts_pipeline_monthly.arn,
3845
aws_sfn_state_machine.concepts_pipeline_daily.arn

catalogue_graph/terraform/state_machine_bulk_loaders.tf

+29
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
resource "aws_sfn_state_machine" "catalogue_graph_bulk_loaders" {
2+
name = "catalogue-graph-bulk-loaders"
3+
role_arn = aws_iam_role.state_machine_execution_role.arn
4+
5+
definition = jsonencode({
6+
Comment = "Trigger the catalogue-graph-bulk-loader state machine in sequence for each combination of inputs."
7+
StartAt = "Load ${var.state_machine_inputs[0].label}"
8+
States = merge(tomap({
9+
for index, task_input in var.state_machine_inputs :
10+
"Load ${task_input.label}" => {
11+
Type = "Task"
12+
Resource = "arn:aws:states:::states:startExecution.sync:2",
13+
Parameters = {
14+
StateMachineArn = aws_sfn_state_machine.catalogue_graph_bulk_loader.arn
15+
Input = {
16+
"transformer_type" = task_input.transformer_type,
17+
"entity_type" = task_input.entity_type
18+
}
19+
}
20+
Next = index == length(var.state_machine_inputs) - 1 ? "Success" : "Load ${var.state_machine_inputs[index + 1].label}"
21+
}
22+
}), {
23+
Success = {
24+
Type = "Succeed"
25+
}
26+
})
27+
28+
})
29+
}
130
resource "aws_sfn_state_machine" "catalogue_graph_bulk_loaders_monthly" {
231
name = "catalogue-graph-bulk-loaders_monthly"
332
role_arn = aws_iam_role.state_machine_execution_role.arn

catalogue_graph/terraform/state_machine_concepts_pipeline.tf

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ resource "aws_sfn_state_machine" "concepts_pipeline_monthly" {
44

55
definition = jsonencode({
66
Comment = "Extract raw concepts from external sources, transform them into nodes and edges, and load them into the graph",
7-
QueryLanguage = "JSONata"
87
StartAt = "Extractors"
98
States = {
109
"Extractors" = {
@@ -36,7 +35,6 @@ resource "aws_sfn_state_machine" "concepts_pipeline_daily" {
3635

3736
definition = jsonencode({
3837
Comment = "Extract concepts from catalogue works, load them into the graph, and ingests into ES index.",
39-
QueryLanguage = "JSONata"
4038
StartAt = "Extractors"
4139
States = {
4240
"Extractors" = {
@@ -58,7 +56,7 @@ resource "aws_sfn_state_machine" "concepts_pipeline_daily" {
5856
"Concepts ingestor" = {
5957
Type = "Task"
6058
Resource = "arn:aws:states:::states:startExecution.sync:2",
61-
Arguments = {
59+
Parameters = {
6260
StateMachineArn = aws_sfn_state_machine.catalogue_graph_ingestor.arn,
6361
}
6462
Next = "Success"

catalogue_graph/terraform/state_machine_extractors.tf

+31
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
resource "aws_sfn_state_machine" "catalogue_graph_extractors" {
2+
name = "catalogue-graph-extractors"
3+
role_arn = aws_iam_role.state_machine_execution_role.arn
4+
5+
definition = jsonencode({
6+
Comment = "Extract raw concepts from all sources, transform them into nodes and edges, and stream them into an S3 bucket."
7+
StartAt = "Extract ${var.state_machine_inputs[0].label}"
8+
9+
States = merge(tomap({
10+
for index, task_input in var.state_machine_inputs :
11+
"Extract ${task_input.label}" => {
12+
Type = "Task"
13+
Resource = "arn:aws:states:::states:startExecution.sync:2",
14+
Parameters = {
15+
StateMachineArn = aws_sfn_state_machine.catalogue_graph_extractor.arn
16+
Input = {
17+
"stream_destination" : "s3",
18+
"transformer_type.$" : "$$.Execution.Input.transformer_type",
19+
"entity_type.$" : "$$.Execution.Input.entity_type",
20+
"sample_size.$" : "$$.Execution.Input.sample_size"
21+
}
22+
}
23+
Next = index == length(var.state_machine_inputs) - 1 ? "Success" : "Extract ${var.state_machine_inputs[index + 1].label}"
24+
}
25+
}), {
26+
Success = {
27+
Type = "Succeed"
28+
}
29+
})
30+
})
31+
}
132
resource "aws_sfn_state_machine" "catalogue_graph_extractors_monthly" {
233
name = "catalogue-graph-extractors_monthly"
334
role_arn = aws_iam_role.state_machine_execution_role.arn

0 commit comments

Comments
 (0)