Skip to content

Instantly share code, notes, and snippets.

@ebridges
Created September 22, 2025 18:59
Show Gist options
  • Select an option

  • Save ebridges/25f1fd7c6cbfbb183b429cbc2a8867fd to your computer and use it in GitHub Desktop.

Select an option

Save ebridges/25f1fd7c6cbfbb183b429cbc2a8867fd to your computer and use it in GitHub Desktop.
Fix `plan` errors in this terraform.
variable assessment_bucket_name {
description = "Name of technical assessment"
type = string
default = "sre-interview"
}
locals {
bucket_name = format("${var.assessment_bucket_name}")
}
# https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket
resource "aws_s3_bucket" "application" {
bucket = local.bucket_name
force_destroy = true
}
# https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy
resource "aws_s3_bucket_policy" "application" {
bucket = aws_s3_bucket.application.name
policy = data.aws_iam_policy_document.application.json
}
# https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document
data "aws_iam_policy_document" "s3" {
statement {
actions = [
"s3:ListBucket",
"s3:PutObject",
]
resources = [format("%s/*", aws_s3_bucket.applictiaon.arn)]
principals {
type = "AWS"
identifiers = [data.aws_partition.current.account_id]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment