Skip to content

Conversation

@jonodrew
Copy link
Contributor

@jonodrew jonodrew commented Dec 9, 2025

Outline terraform for creating an S3 bucket and IAM role for @till to try out his auth stuff

Signed-off-by: jonathan.kerr <3410350+jonodrew@users.noreply.github.com>
This should add an S3 bucket and a role that can do things with it.

Signed-off-by: jonathan.kerr <3410350+jonodrew@users.noreply.github.com>
This creates a user and the appropriate role for the user. I've used the sts AssumeRole approach here, to separate the admin role from the user

Signed-off-by: jonathan.kerr <3410350+jonodrew@users.noreply.github.com>
Signed-off-by: jonathan.kerr <3410350+jonodrew@users.noreply.github.com>

# 1. S3 Bucket (private by default)
resource "aws_s3_bucket" "auth_bucket" {
bucket = "codebar-planner-auth-bucket"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to create buckets myself, but otherwise I'd like 2 - one prod, one staging.

"s3:GetObject", # Read/download files
"s3:PutObject", # Upload files
"s3:DeleteObject", # Optional: allow deleting files
"s3:ListAllMyBuckets" # enable user to list all buckets
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be un-scoped - per bucket, you need something like this (this is the json format):

{
   "Version":"2012-10-17",		 	 	 
   "Statement":[
      {
         "Effect":"Allow",
         "Action": "s3:ListAllMyBuckets",
         "Resource":"*"
      },
      {
         "Effect":"Allow",
         "Action":["s3:ListBucket","s3:GetBucketLocation"],
         "Resource":"arn:aws:s3:::bucket-name-etc"
      },
      {
         "Effect":"Allow",
         "Action":[
            "s3:PutObject",
            "s3:GetObject",
            "s3:DeleteObject"
         ],
         "Resource":"arn:aws:s3:::bucket-name-etc/*"
      }
   ]
}

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.

2 participants