Skip to content

Let incubator-tf-plan read Amazon Location resources - #230

Merged
ale210 merged 2 commits into
mainfrom
incubator-plan-location-read
Nov 20, 2026
Merged

ale210 merged 2 commits into
mainfrom
incubator-plan-location-read

Conversation

@ale210

@ale210 ale210 commented Nov 20, 2026

Copy link
Copy Markdown
Member

Every incubator Terraform plan has failed since hackforla/incubator#290 created the Food Oasis place indexes:

incubator-tf-plan is not authorized to perform: geo:DescribePlaceIndex on place-index/food-oasis-stage

incubator-tf-plan reads AWS through the managed ReadOnlyAccess policy, which grants no geo: actions. The apply role has AdministratorAccess, so the apply worked, but every plan after it has to read the indexes and can't.

  • New custom policy IncubatorTfPlanLocationRead (geo:Describe*, geo:List*), attached to incubator-tf-plan. The wildcards also cover the Location resources Deploy the Food Oasis staging service incubator#281 and #282 will add.
  • This is a new policy rather than a statement added to tf-plan-scoped.json, because the plan and apply workflows only run for .tf changes. A JSON-only edit would never be planned or applied.

Expected plan: 2 to add (the policy and its attachment), 0 to change, 0 to destroy.

After this merges and applies, re-run the failed Terraform Plan job on hackforla/incubator#291 and confirm it passes.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Terraform plan in terraform
With backend config files: terraform/prod.backend.tfvars
With variables: iam_only = false

Plan: 2 to add, 0 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

Terraform will perform the following actions:

  # aws_iam_role_policy_attachment.incubator_tf_plan_location_read will be created
+   resource "aws_iam_role_policy_attachment" "incubator_tf_plan_location_read" {
+       id         = (known after apply)
+       policy_arn = (known after apply)
+       role       = "incubator-tf-plan"
    }

  # module.aws_custom_policies.aws_iam_policy.custom_policy["IncubatorTfPlanLocationRead"] will be created
+   resource "aws_iam_policy" "custom_policy" {
+       arn              = (known after apply)
+       attachment_count = (known after apply)
+       description      = "Allows incubator tf plan role to read Amazon Location resources during terraform plan"
+       id               = (known after apply)
+       name             = "IncubatorTfPlanLocationRead"
+       name_prefix      = (known after apply)
+       path             = "/"
+       policy           = jsonencode(
            {
+               Statement = [
+                   {
+                       Action   = [
+                           "geo:Describe*",
+                           "geo:List*",
                        ]
+                       Effect   = "Allow"
+                       Resource = "*"
+                       Sid      = "AllowLocationReadForTerraformPlan"
                    },
                ]
+               Version   = "2012-10-17"
            }
        )
+       policy_id        = (known after apply)
+       tags_all         = {
+           "managed-by" = "terraform-devops-security"
        }
    }

Plan: 2 to add, 0 to change, 0 to destroy.

✅ Plan applied in Apply Terraform changes on merge #61

@ale210
ale210 merged commit 61cca39 into main Nov 20, 2026
@ale210
ale210 deleted the incubator-plan-location-read branch November 20, 2026 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant