Repository navigation
Add the Food Oasis staging service - #299
Merged
Merged
Conversation
Contributor
|
Terraform plan in terraform Plan: 16 to add, 2 to change, 0 to destroy.Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
!~ update in-place
Terraform will perform the following actions:
# module.food-oasis.aws_iam_role_policy_attachment.food_oasis_stage_location will be created
+ resource "aws_iam_role_policy_attachment" "food_oasis_stage_location" {
+ id = (known after apply)
+ policy_arn = "arn:aws:iam::035866691871:policy/food-oasis-stage-location-search"
+ role = "ecs-container-food-oasis-fullstack-stage"
}
# module.food-oasis.module.food_oasis_fullstack_stage_service.aws_cloudwatch_log_group.this will be created
+ resource "aws_cloudwatch_log_group" "this" {
+ arn = (known after apply)
+ deletion_protection_enabled = (known after apply)
+ id = (known after apply)
+ log_group_class = (known after apply)
+ name = "/ecs/food-oasis-fullstack-stage"
+ name_prefix = (known after apply)
+ region = "us-west-2"
+ retention_in_days = 0
+ skip_destroy = false
+ tags = {
+ "project" = "food-oasis"
}
+ tags_all = {
+ "managed-by" = "terraform-incubator"
+ "project" = "food-oasis"
}
}
# module.food-oasis.module.food_oasis_fullstack_stage_service.aws_ecs_service.fargate[0] will be created
+ resource "aws_ecs_service" "fargate" {
+ arn = (known after apply)
+ availability_zone_rebalancing = "DISABLED"
+ cluster = "incubator-prod"
+ deployment_maximum_percent = 200
+ deployment_minimum_healthy_percent = 0
+ desired_count = 1
+ enable_ecs_managed_tags = false
+ enable_execute_command = true
+ iam_role = (known after apply)
+ id = (known after apply)
+ launch_type = "EC2"
+ name = "food-oasis-fullstack-stage"
+ platform_version = (known after apply)
+ propagate_tags = "SERVICE"
+ region = "us-west-2"
+ scheduling_strategy = "REPLICA"
+ tags = {
+ "project" = "food-oasis"
}
+ tags_all = {
+ "managed-by" = "terraform-incubator"
+ "project" = "food-oasis"
}
+ task_definition = (known after apply)
+ triggers = (known after apply)
+ wait_for_steady_state = false
+ deployment_configuration (known after apply)
+ load_balancer {
+ container_name = "food-oasis-fullstack-stage"
+ container_port = 5001
+ target_group_arn = (known after apply)
# (1 unchanged attribute hidden)
}
+ ordered_placement_strategy {
+ field = "memory"
+ type = "binpack"
}
}
# module.food-oasis.module.food_oasis_fullstack_stage_service.aws_ecs_task_definition.task will be created
+ resource "aws_ecs_task_definition" "task" {
+ arn = (known after apply)
+ arn_without_revision = (known after apply)
+ container_definitions = (known after apply)
+ enable_fault_injection = (known after apply)
+ execution_role_arn = (known after apply)
+ family = "food-oasis-fullstack-stage"
+ id = (known after apply)
+ network_mode = "bridge"
+ region = "us-west-2"
+ requires_compatibilities = [
+ "EC2",
]
+ revision = (known after apply)
+ skip_destroy = false
+ tags = {
+ "project" = "food-oasis"
}
+ tags_all = {
+ "managed-by" = "terraform-incubator"
+ "project" = "food-oasis"
}
+ task_role_arn = (known after apply)
+ track_latest = false
}
# module.food-oasis.module.food_oasis_fullstack_stage_service.aws_iam_policy.container_policy will be created
+ resource "aws_iam_policy" "container_policy" {
+ arn = (known after apply)
+ attachment_count = (known after apply)
+ id = (known after apply)
+ name = "food-oasis-fullstack-stage-task-policy"
+ name_prefix = (known after apply)
+ path = "/"
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "ssmmessages:CreateControlChannel",
+ "ssmmessages:CreateDataChannel",
+ "ssmmessages:OpenControlChannel",
+ "ssmmessages:OpenDataChannel",
]
+ Effect = "Allow"
+ Resource = "*"
+ Sid = "EcsExecuteCommand"
},
+ {
+ Action = [
+ "s3:ListBucket",
+ "s3:GetObject",
+ "s3:PutObject",
+ "s3:DeleteObject",
]
+ Condition = {
+ Null = {
+ "aws:ResourceTag/project" = "false"
}
+ StringEquals = {
+ "aws:ResourceTag/project" = "food-oasis"
}
}
+ Effect = "Allow"
+ Resource = [
+ "arn:aws:s3:::*",
+ "arn:aws:s3:::*/*",
]
+ Sid = "ProjectBucketAccess"
},
+ {
+ Action = [
+ "cognito-idp:AdminGetUser",
+ "cognito-idp:AdminCreateUser",
+ "cognito-idp:AdminAddUserToGroup",
+ "cognito-idp:AdminDeleteUser",
]
+ Condition = {
+ StringEquals = {
+ "aws:ResourceTag/project" = "food-oasis"
}
}
+ Effect = "Allow"
+ Resource = "arn:aws:cognito-idp:us-west-2:035866691871:userpool/*"
+ Sid = "ProjectCognitoAdmin"
},
]
+ Version = "2012-10-17"
}
)
+ policy_id = (known after apply)
+ tags_all = {
+ "managed-by" = "terraform-incubator"
}
# (1 unchanged attribute hidden)
}
# module.food-oasis.module.food_oasis_fullstack_stage_service.aws_iam_policy.execution_policy will be created
+ resource "aws_iam_policy" "execution_policy" {
+ arn = (known after apply)
+ attachment_count = (known after apply)
+ description = "ECS execution role for food-oasis-fullstack-stage: image pull, logs and secrets, scoped to project food-oasis"
+ id = (known after apply)
+ name = "food-oasis-fullstack-stage-execution-policy"
+ name_prefix = (known after apply)
+ path = "/"
+ policy = (known after apply)
+ policy_id = (known after apply)
+ tags = {
+ "project" = "food-oasis"
}
+ tags_all = {
+ "managed-by" = "terraform-incubator"
+ "project" = "food-oasis"
}
}
# module.food-oasis.module.food_oasis_fullstack_stage_service.aws_iam_role.execution will be created
+ resource "aws_iam_role" "execution" {
+ arn = (known after apply)
+ assume_role_policy = jsonencode(
{
+ Statement = [
+ {
+ Action = "sts:AssumeRole"
+ Effect = "Allow"
+ Principal = {
+ Service = "ecs-tasks.amazonaws.com"
}
+ Sid = ""
},
]
+ Version = "2012-10-17"
}
)
+ create_date = (known after apply)
+ force_detach_policies = false
+ id = (known after apply)
+ managed_policy_arns = (known after apply)
+ max_session_duration = 3600
+ name = "ecs-execution-food-oasis-fullstack-stage"
+ name_prefix = (known after apply)
+ path = "/"
+ tags = {
+ "project" = "food-oasis"
}
+ tags_all = {
+ "managed-by" = "terraform-incubator"
+ "project" = "food-oasis"
}
+ unique_id = (known after apply)
+ inline_policy (known after apply)
}
# module.food-oasis.module.food_oasis_fullstack_stage_service.aws_iam_role.instance will be created
+ resource "aws_iam_role" "instance" {
+ arn = (known after apply)
+ assume_role_policy = jsonencode(
{
+ Statement = [
+ {
+ Action = "sts:AssumeRole"
+ Effect = "Allow"
+ Principal = {
+ Service = "ecs-tasks.amazonaws.com"
}
+ Sid = ""
},
]
+ Version = "2012-10-17"
}
)
+ create_date = (known after apply)
+ force_detach_policies = false
+ id = (known after apply)
+ managed_policy_arns = (known after apply)
+ max_session_duration = 3600
+ name = "ecs-container-food-oasis-fullstack-stage"
+ name_prefix = (known after apply)
+ path = "/"
+ tags = {
+ "project" = "food-oasis"
}
+ tags_all = {
+ "managed-by" = "terraform-incubator"
+ "project" = "food-oasis"
}
+ unique_id = (known after apply)
+ inline_policy (known after apply)
}
# module.food-oasis.module.food_oasis_fullstack_stage_service.aws_iam_role_policy_attachment.execution_policy will be created
+ resource "aws_iam_role_policy_attachment" "execution_policy" {
+ id = (known after apply)
+ policy_arn = (known after apply)
+ role = "ecs-execution-food-oasis-fullstack-stage"
}
# module.food-oasis.module.food_oasis_fullstack_stage_service.aws_iam_role_policy_attachment.task_policy will be created
+ resource "aws_iam_role_policy_attachment" "task_policy" {
+ id = (known after apply)
+ policy_arn = (known after apply)
+ role = "ecs-container-food-oasis-fullstack-stage"
}
# module.food-oasis.module.food_oasis_fullstack_stage_service.aws_lb_listener_rule.static will be created
+ resource "aws_lb_listener_rule" "static" {
+ arn = (known after apply)
+ id = (known after apply)
+ listener_arn = "arn:aws:elasticloadbalancing:us-west-2:035866691871:listener/app/incubator-prod-lb/7451adf77133ef36/390a225766a4daf3"
+ priority = 600
+ region = "us-west-2"
+ tags_all = {
+ "managed-by" = "terraform-incubator"
}
+ action {
+ order = (known after apply)
+ target_group_arn = (known after apply)
+ type = "forward"
}
+ condition {
+ host_header {
+ regex_values = []
+ values = [
+ "dev*.foodoasis.la",
+ "dev*.foodoasis.net",
]
}
}
+ condition {
+ path_pattern {
+ regex_values = []
+ values = [
+ "/*",
]
}
}
}
# module.food-oasis.module.food_oasis_fullstack_stage_service.aws_lb_target_group.this will be created
+ resource "aws_lb_target_group" "this" {
+ arn = (known after apply)
+ arn_suffix = (known after apply)
+ connection_termination = (known after apply)
+ deregistration_delay = "10"
+ id = (known after apply)
+ ip_address_type = (known after apply)
+ lambda_multi_value_headers_enabled = false
+ load_balancer_arns = (known after apply)
+ load_balancing_algorithm_type = (known after apply)
+ load_balancing_anomaly_mitigation = (known after apply)
+ load_balancing_cross_zone_enabled = (known after apply)
+ name = "food-oasis-fullstack-stage-d7f"
+ name_prefix = (known after apply)
+ port = 5001
+ preserve_client_ip = (known after apply)
+ protocol = "HTTP"
+ protocol_version = (known after apply)
+ proxy_protocol_v2 = false
+ region = "us-west-2"
+ slow_start = 0
+ tags_all = {
+ "managed-by" = "terraform-incubator"
}
+ target_type = "instance"
+ vpc_id = "*********************"
+ health_check {
+ enabled = true
+ healthy_threshold = 3
+ interval = 30
+ matcher = "200,400,404"
+ path = "/health"
+ port = "traffic-port"
+ protocol = "HTTP"
+ timeout = (known after apply)
+ unhealthy_threshold = 3
}
+ stickiness (known after apply)
+ target_failover (known after apply)
+ target_group_health (known after apply)
+ target_health_state {
+ enable_unhealthy_connection_termination = false
+ unhealthy_draining_interval = 0
}
}
# module.food-oasis.module.food_oasis_stage_database.postgresql_grant.user will be updated in-place
!~ resource "postgresql_grant" "user" {
id = "food-oasis_fullstack_stage_user_food-oasis_fullstack_stage_public_table"
!~ privileges = [
+ "DELETE",
+ "INSERT",
+ "SELECT",
+ "UPDATE",
]
# (5 unchanged attributes hidden)
}
# module.food-oasis.module.food_oasis_stage_database.postgresql_grant.viewer will be updated in-place
!~ resource "postgresql_grant" "viewer" {
id = "food-oasis_fullstack_stage_viewer_food-oasis_fullstack_stage_public_table"
!~ privileges = [
+ "SELECT",
]
# (5 unchanged attributes hidden)
}
# module.food-oasis.module.food_oasis_stage_jwt_secret.aws_ssm_parameter.this will be created
+ resource "aws_ssm_parameter" "this" {
+ arn = (known after apply)
+ data_type = (known after apply)
+ has_value_wo = (known after apply)
+ id = (known after apply)
+ insecure_value = (known after apply)
+ key_id = (known after apply)
+ name = "/food-oasis/fullstack-stage-jwt-secret"
+ region = "us-west-2"
+ tags = {
+ "project" = "food-oasis"
}
+ tags_all = {
+ "managed-by" = "terraform-incubator"
+ "project" = "food-oasis"
}
+ tier = (known after apply)
+ type = "SecureString"
+ value = (sensitive value)
+ value_wo = (write-only attribute)
+ version = (known after apply)
}
# module.food-oasis.module.food_oasis_stage_jwt_secret.random_password.password will be created
+ resource "random_password" "password" {
+ bcrypt_hash = (sensitive value)
+ id = (known after apply)
+ length = 48
+ lower = true
+ min_lower = 0
+ min_numeric = 0
+ min_special = 0
+ min_upper = 0
+ number = true
+ numeric = true
+ override_special = "!#$-"
+ result = (sensitive value)
+ special = true
+ upper = true
}
# module.food-oasis.module.food_oasis_stage_ses.aws_iam_policy.this will be created
+ resource "aws_iam_policy" "this" {
+ arn = (known after apply)
+ attachment_count = (known after apply)
+ description = "Send email through specific SES identities"
+ id = (known after apply)
+ name = "food-oasis-stage-ses-send"
+ name_prefix = (known after apply)
+ path = "/"
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "ses:SendEmail",
+ "ses:SendRawEmail",
]
+ Effect = "Allow"
+ Resource = [
+ "arn:aws:ses:us-west-2:035866691871:identity/foodoasis.net",
]
+ Sid = "SendFromIdentities"
},
]
+ Version = "2012-10-17"
}
)
+ policy_id = (known after apply)
+ tags = {
+ "project" = "food-oasis"
}
+ tags_all = {
+ "managed-by" = "terraform-incubator"
+ "project" = "food-oasis"
}
}
# module.food-oasis.module.food_oasis_stage_ses.aws_iam_role_policy_attachment.this will be created
+ resource "aws_iam_role_policy_attachment" "this" {
+ id = (known after apply)
+ policy_arn = (known after apply)
+ role = "ecs-container-food-oasis-fullstack-stage"
}
Plan: 16 to add, 2 to change, 0 to destroy.✅ Plan applied in Terraform apply (OIDC) #124 |
ale210
added a commit
that referenced
this pull request
Nov 20, 2026
Part of #281. The Food Oasis staging service from #299 keeps being replaced by ECS: its load balancer health check gets a 302. With `NODE_ENV=production` the app redirects every request without `X-Forwarded-Proto: https` to HTTPS, `/health` included, and the health check sends plain HTTP without that header. - `modules/container`: new `health_check_matcher` variable. Its default is the old hardcoded `200,400,404`, so no other service changes. - Food Oasis staging sets it to `200,302`. That only proves the process answers; moving `/health` above the redirect in hackforla/food-oasis `server/server.ts` would let it go back to the default. Expected plan: one in-place update, the staging target group's matcher. Nothing else. --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #281.
Adds the Food Oasis staging service on the shared cluster, in
terraform/projects/food-oasis/environment-stage.tf:modules/container: EC2, bridge, port 5001,/health, imagefood-oasis-fullstack:stage, hostsdev*.foodoasis.netanddev*.foodoasis.la, listener priority 600._owner, over SSL (incubator-prod-databaseforces it).JWT_SECRETis generated bymodules/secretand passed as a secret.DATABASE_URL, AWS keys,AWS_PROFILEorIDENTITY_POOL_ID, so the app uses its task role (Let Food Oasis use its task role for SES and Amazon Location #277).modules/ses-container-permissionsfor thefoodoasis.netidentity (Set up SES for Food Oasis in the incubator account #279) and the stage Location policy (Set up Amazon Location for Food Oasis in the incubator account #280) on the task role.The staging data was copied into
food-oasis_fullstack_stagebefore this PR (see the comments on #281), so the plan should also show in-place updates to the stage database'spostgresql_grant.userand.viewer: the apply grants them on the restored tables.Expected plan: new resources only, plus those two grant updates. Nothing destroyed.