Sets up toast

This commit is contained in:
2023-12-03 20:20:26 -08:00
parent eb6441b36d
commit df4410ac9d
4 changed files with 193 additions and 154 deletions

View File

@@ -243,6 +243,8 @@
{:db/doc "square processor", {:db/doc "square processor",
:db/ident :ccp-processor/square} :db/ident :ccp-processor/square}
{:db/doc "toast processor",
:db/ident :ccp-processor/toast}
{:db/doc "ezcater processor", {:db/doc "ezcater processor",
:db/ident :ccp-processor/ezcater} :db/ident :ccp-processor/ezcater}
{:db/doc "koala processor", {:db/doc "koala processor",
@@ -256,6 +258,13 @@
{:db/doc "No specific ccp processor", {:db/doc "No specific ccp processor",
:db/ident :ccp-processor/na} :db/ident :ccp-processor/na}
{:db/doc "Use 'Menu Group' for item category",
:db/ident :toast-category-column/menu-group}
{:db/doc "Use 'Menu' for item category",
:db/ident :toast-category-column/menu}
{:db/doc "Use 'Sales Category' for item category",
:db/ident :toast-category-column/sales-category}
{:db/valueType #:db{:ident :db.type/string}, {:db/valueType #:db{:ident :db.type/string},
:db/cardinality #:db{:ident :db.cardinality/one}, :db/cardinality #:db{:ident :db.cardinality/one},
:db/doc "The type of the charge", :db/doc "The type of the charge",

View File

@@ -108,6 +108,33 @@ POLICY
} }
} }
resource "aws_s3_bucket" "toast_bucket" {
bucket = "toast.${var.stage}.app.integreatconsult.com"
}
resource "aws_s3_bucket_policy" "toast_policy" {
bucket = aws_s3_bucket.toast_bucket.id
policy = data.aws_iam_policy_document.toast_policy_doc.json
}
data "aws_iam_policy_document" "toast_policy_doc" {
statement {
principals {
type = "AWS"
identifiers = ["${var.task_role_arn}", "arn:aws:iam::679918342773:role/http-proxy"]
}
actions = [
"s3:*",
]
resources = [
aws_s3_bucket.toast_bucket.arn,
"${aws_s3_bucket.toast_bucket.arn}/*",
]
}
}
resource "aws_sqs_queue" "integreat-mail" { resource "aws_sqs_queue" "integreat-mail" {
name = "integreat-mail-${var.stage}" name = "integreat-mail-${var.stage}"

View File

@@ -1,7 +1,7 @@
{ {
"version": 4, "version": 4,
"terraform_version": "1.6.1", "terraform_version": "1.6.3",
"serial": 529, "serial": 535,
"lineage": "9b630886-8cee-a57d-c7a2-4f19f13f9c51", "lineage": "9b630886-8cee-a57d-c7a2-4f19f13f9c51",
"outputs": { "outputs": {
"aws_access_key_id": { "aws_access_key_id": {
@@ -42,6 +42,54 @@
} }
] ]
}, },
{
"mode": "data",
"type": "aws_iam_policy_document",
"name": "toast_policy_doc",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "2919533105",
"json": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"\",\n \"Effect\": \"Allow\",\n \"Action\": \"s3:*\",\n \"Resource\": [\n \"arn:aws:s3:::toast.prod.app.integreatconsult.com/*\",\n \"arn:aws:s3:::toast.prod.app.integreatconsult.com\"\n ],\n \"Principal\": {\n \"AWS\": [\n \"arn:aws:iam::679918342773:role/http-proxy\",\n \"arn:aws:iam::679918342773:role/datomic-ddb\"\n ]\n }\n }\n ]\n}",
"override_json": null,
"override_policy_documents": null,
"policy_id": null,
"source_json": null,
"source_policy_documents": null,
"statement": [
{
"actions": [
"s3:*"
],
"condition": [],
"effect": "Allow",
"not_actions": [],
"not_principals": [],
"not_resources": [],
"principals": [
{
"identifiers": [
"arn:aws:iam::679918342773:role/datomic-ddb",
"arn:aws:iam::679918342773:role/http-proxy"
],
"type": "AWS"
}
],
"resources": [
"arn:aws:s3:::toast.prod.app.integreatconsult.com",
"arn:aws:s3:::toast.prod.app.integreatconsult.com/*"
],
"sid": ""
}
],
"version": "2012-10-17"
},
"sensitive_attributes": []
}
]
},
{ {
"mode": "managed", "mode": "managed",
"type": "aws_acm_certificate", "type": "aws_acm_certificate",
@@ -233,7 +281,7 @@
], ],
"tags": {}, "tags": {},
"tags_all": {}, "tags_all": {},
"task_definition": "arn:aws:ecs:us-east-1:679918342773:task-definition/integreat_app_prod:679", "task_definition": "arn:aws:ecs:us-east-1:679918342773:task-definition/integreat_app_prod:686",
"timeouts": { "timeouts": {
"create": null, "create": null,
"delete": null, "delete": null,
@@ -465,9 +513,9 @@
"provisioned_throughput_in_mibps": 0, "provisioned_throughput_in_mibps": 0,
"size_in_bytes": [ "size_in_bytes": [
{ {
"value": 736219136, "value": 780294144,
"value_in_ia": 0, "value_in_ia": 0,
"value_in_standard": 736219136 "value_in_standard": 780294144
} }
], ],
"tags": { "tags": {
@@ -1131,6 +1179,77 @@
} }
] ]
}, },
{
"mode": "managed",
"type": "aws_s3_bucket",
"name": "toast_bucket",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"acceleration_status": "",
"acl": null,
"arn": "arn:aws:s3:::toast.prod.app.integreatconsult.com",
"bucket": "toast.prod.app.integreatconsult.com",
"bucket_domain_name": "toast.prod.app.integreatconsult.com.s3.amazonaws.com",
"bucket_prefix": "",
"bucket_regional_domain_name": "toast.prod.app.integreatconsult.com.s3.amazonaws.com",
"cors_rule": [],
"force_destroy": false,
"grant": [
{
"id": "e30528e0ba05fd1f250869c1b4db0eff90001b4d9ad90dd2e01b210844f83e5a",
"permissions": [
"FULL_CONTROL"
],
"type": "CanonicalUser",
"uri": ""
}
],
"hosted_zone_id": "Z3AQBSTGFYJSTF",
"id": "toast.prod.app.integreatconsult.com",
"lifecycle_rule": [],
"logging": [],
"object_lock_configuration": [],
"object_lock_enabled": false,
"policy": "",
"region": "us-east-1",
"replication_configuration": [],
"request_payer": "BucketOwner",
"server_side_encryption_configuration": [
{
"rule": [
{
"apply_server_side_encryption_by_default": [
{
"kms_master_key_id": "",
"sse_algorithm": "AES256"
}
],
"bucket_key_enabled": false
}
]
}
],
"tags": null,
"tags_all": {},
"timeouts": null,
"versioning": [
{
"enabled": false,
"mfa_delete": false
}
],
"website": [],
"website_domain": null,
"website_endpoint": null
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjM2MDAwMDAwMDAwMDAsInJlYWQiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19"
}
]
},
{ {
"mode": "managed", "mode": "managed",
"type": "aws_s3_bucket_notification", "type": "aws_s3_bucket_notification",
@@ -1166,6 +1285,28 @@
} }
] ]
}, },
{
"mode": "managed",
"type": "aws_s3_bucket_policy",
"name": "toast_policy",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"bucket": "toast.prod.app.integreatconsult.com",
"id": "toast.prod.app.integreatconsult.com",
"policy": "{\"Statement\":[{\"Action\":\"s3:*\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"arn:aws:iam::679918342773:role/http-proxy\",\"arn:aws:iam::679918342773:role/datomic-ddb\"]},\"Resource\":[\"arn:aws:s3:::toast.prod.app.integreatconsult.com/*\",\"arn:aws:s3:::toast.prod.app.integreatconsult.com\"],\"Sid\":\"\"}],\"Version\":\"2012-10-17\"}"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_s3_bucket.toast_bucket",
"data.aws_iam_policy_document.toast_policy_doc"
]
}
]
},
{ {
"mode": "managed", "mode": "managed",
"type": "aws_service_discovery_service", "type": "aws_service_discovery_service",

View File

@@ -1,7 +1,7 @@
{ {
"version": 4, "version": 4,
"terraform_version": "1.6.1", "terraform_version": "1.6.3",
"serial": 524, "serial": 531,
"lineage": "9b630886-8cee-a57d-c7a2-4f19f13f9c51", "lineage": "9b630886-8cee-a57d-c7a2-4f19f13f9c51",
"outputs": { "outputs": {
"aws_access_key_id": { "aws_access_key_id": {
@@ -233,7 +233,7 @@
], ],
"tags": {}, "tags": {},
"tags_all": {}, "tags_all": {},
"task_definition": "arn:aws:ecs:us-east-1:679918342773:task-definition/integreat_app_prod:631", "task_definition": "arn:aws:ecs:us-east-1:679918342773:task-definition/integreat_app_prod:686",
"timeouts": { "timeouts": {
"create": null, "create": null,
"delete": null, "delete": null,
@@ -465,9 +465,9 @@
"provisioned_throughput_in_mibps": 0, "provisioned_throughput_in_mibps": 0,
"size_in_bytes": [ "size_in_bytes": [
{ {
"value": 643549184, "value": 780294144,
"value_in_ia": 0, "value_in_ia": 0,
"value_in_standard": 643549184 "value_in_standard": 780294144
} }
], ],
"tags": { "tags": {
@@ -832,19 +832,19 @@
"attributes": { "attributes": {
"arn": "arn:aws:elasticloadbalancing:us-east-1:679918342773:targetgroup/integreat-app-prod/d5b51736182d8407", "arn": "arn:aws:elasticloadbalancing:us-east-1:679918342773:targetgroup/integreat-app-prod/d5b51736182d8407",
"arn_suffix": "targetgroup/integreat-app-prod/d5b51736182d8407", "arn_suffix": "targetgroup/integreat-app-prod/d5b51736182d8407",
"connection_termination": null, "connection_termination": false,
"deregistration_delay": "120", "deregistration_delay": "120",
"health_check": [ "health_check": [
{ {
"enabled": true, "enabled": true,
"healthy_threshold": 2, "healthy_threshold": 2,
"interval": 15, "interval": 60,
"matcher": "200", "matcher": "200",
"path": "/api/health-check", "path": "/api/health-check",
"port": "traffic-port", "port": "traffic-port",
"protocol": "HTTP", "protocol": "HTTP",
"timeout": 14, "timeout": 14,
"unhealthy_threshold": 5 "unhealthy_threshold": 3
} }
], ],
"id": "arn:aws:elasticloadbalancing:us-east-1:679918342773:targetgroup/integreat-app-prod/d5b51736182d8407", "id": "arn:aws:elasticloadbalancing:us-east-1:679918342773:targetgroup/integreat-app-prod/d5b51736182d8407",
@@ -1902,7 +1902,7 @@
"name_prefix": "", "name_prefix": "",
"role_arn": "", "role_arn": "",
"schedule_expression": "rate(6 hours)", "schedule_expression": "rate(6 hours)",
"tags": null, "tags": {},
"tags_all": {} "tags_all": {}
}, },
"sensitive_attributes": [], "sensitive_attributes": [],
@@ -1949,7 +1949,7 @@
"placement_constraint": [], "placement_constraint": [],
"platform_version": "", "platform_version": "",
"propagate_tags": "TASK_DEFINITION", "propagate_tags": "TASK_DEFINITION",
"tags": null, "tags": {},
"task_count": 1, "task_count": 1,
"task_definition_arn": "arn:aws:ecs:us-east-1:679918342773:task-definition/insight_outcome_recommendation_prod:1" "task_definition_arn": "arn:aws:ecs:us-east-1:679918342773:task-definition/insight_outcome_recommendation_prod:1"
} }
@@ -2009,7 +2009,7 @@
"revision": 1, "revision": 1,
"runtime_platform": [], "runtime_platform": [],
"skip_destroy": false, "skip_destroy": false,
"tags": null, "tags": {},
"tags_all": {}, "tags_all": {},
"task_role_arn": "arn:aws:iam::679918342773:role/datomic-ddb", "task_role_arn": "arn:aws:iam::679918342773:role/datomic-ddb",
"volume": [] "volume": []
@@ -2653,144 +2653,6 @@
} }
] ]
}, },
{
"module": "module.square2_import_job",
"mode": "managed",
"type": "aws_cloudwatch_event_rule",
"name": "schedule",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": 0,
"schema_version": 0,
"attributes": {
"arn": "arn:aws:events:us-east-1:679918342773:rule/square2-import-job-schedule",
"description": "",
"event_bus_name": "default",
"event_pattern": null,
"id": "square2-import-job-schedule",
"is_enabled": true,
"name": "square2-import-job-schedule",
"name_prefix": "",
"role_arn": "",
"schedule_expression": "rate(5 hours)",
"tags": {},
"tags_all": {}
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
},
{
"module": "module.square2_import_job",
"mode": "managed",
"type": "aws_cloudwatch_event_target",
"name": "job_target",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"index_key": 0,
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ecs:us-east-1:679918342773:cluster/default",
"batch_target": [],
"dead_letter_config": [],
"ecs_target": [
{
"capacity_provider_strategy": [],
"enable_ecs_managed_tags": false,
"enable_execute_command": false,
"group": "",
"launch_type": "FARGATE",
"network_configuration": [
{
"assign_public_ip": true,
"security_groups": [
"sg-004e5855310c453a3",
"sg-02d167406b1082698"
],
"subnets": [
"subnet-5e675761",
"subnet-8519fde2",
"subnet-89bab8d4"
]
}
],
"ordered_placement_strategy": [],
"placement_constraint": [],
"platform_version": "",
"propagate_tags": "TASK_DEFINITION",
"tags": {},
"task_count": 1,
"task_definition_arn": "arn:aws:ecs:us-east-1:679918342773:task-definition/square2_import_job_prod:2"
}
],
"event_bus_name": "default",
"http_target": [],
"id": "square2-import-job-schedule-square2-import-job",
"input": "",
"input_path": "",
"input_transformer": [],
"kinesis_target": [],
"redshift_target": [],
"retry_policy": [],
"role_arn": "arn:aws:iam::679918342773:role/service-role/Amazon_EventBridge_Invoke_ECS_1758992733",
"rule": "square2-import-job-schedule",
"run_command_targets": [],
"sqs_target": [],
"target_id": "square2-import-job"
},
"sensitive_attributes": [],
"private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==",
"dependencies": [
"module.square2_import_job.aws_cloudwatch_event_rule.schedule",
"module.square2_import_job.aws_ecs_task_definition.background_taskdef"
]
}
]
},
{
"module": "module.square2_import_job",
"mode": "managed",
"type": "aws_ecs_task_definition",
"name": "background_taskdef",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ecs:us-east-1:679918342773:task-definition/square2_import_job_prod:2",
"arn_without_revision": "arn:aws:ecs:us-east-1:679918342773:task-definition/square2_import_job_prod",
"container_definitions": "[{\"cpu\":0,\"dockerLabels\":{\"com.datadoghq.tags.env\":\"prod\",\"com.datadoghq.tags.service\":\"square2-import-job\"},\"environment\":[{\"name\":\"DD_CONTAINER_ENV_AS_TAGS\",\"value\":\"{\\\"INTEGREAT_JOB\\\":\\\"background_job\\\"}\"},{\"name\":\"DD_ENV\",\"value\":\"prod\"},{\"name\":\"DD_SERVICE\",\"value\":\"square2-import-job\"},{\"name\":\"INTEGREAT_JOB\",\"value\":\"square2-import-job\"},{\"name\":\"config\",\"value\":\"/usr/local/config/prod-background-worker.edn\"}],\"essential\":true,\"image\":\"679918342773.dkr.ecr.us-east-1.amazonaws.com/integreat-cloud:prod\",\"logConfiguration\":{\"logDriver\":\"awslogs\",\"options\":{\"awslogs-group\":\"/ecs/integreat-app-prod\",\"awslogs-region\":\"us-east-1\",\"awslogs-stream-prefix\":\"ecs\"}},\"mountPoints\":[],\"name\":\"integreat-app\",\"portMappings\":[{\"containerPort\":9000,\"hostPort\":9000,\"protocol\":\"tcp\"},{\"containerPort\":9090,\"hostPort\":9090,\"protocol\":\"tcp\"}],\"volumesFrom\":[]},{\"cpu\":0,\"environment\":[{\"name\":\"DD_API_KEY\",\"value\":\"ce10d932c47b358e81081ae67bd8c112\"},{\"name\":\"ECS_FARGATE\",\"value\":\"true\"}],\"essential\":true,\"image\":\"public.ecr.aws/datadog/agent:latest\",\"mountPoints\":[],\"name\":\"datadog-agent\",\"portMappings\":[],\"volumesFrom\":[]}]",
"cpu": "1024",
"ephemeral_storage": [],
"execution_role_arn": "arn:aws:iam::679918342773:role/ecsTaskExecutionRole",
"family": "square2_import_job_prod",
"id": "square2_import_job_prod",
"inference_accelerator": [],
"ipc_mode": "",
"memory": "4096",
"network_mode": "awsvpc",
"pid_mode": "",
"placement_constraints": [],
"proxy_configuration": [],
"requires_compatibilities": [
"FARGATE"
],
"revision": 2,
"runtime_platform": [],
"skip_destroy": null,
"tags": {},
"tags_all": {},
"task_role_arn": "arn:aws:iam::679918342773:role/datomic-ddb",
"volume": []
},
"sensitive_attributes": [],
"private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ=="
}
]
},
{ {
"module": "module.square_import_job", "module": "module.square_import_job",
"mode": "managed", "mode": "managed",