Created
September 22, 2025 18:59
-
-
Save ebridges/25f1fd7c6cbfbb183b429cbc2a8867fd to your computer and use it in GitHub Desktop.
Fix `plan` errors in this terraform.
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
| 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