Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions deploy/infrastructure/iam.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
### Squared User - S3 Read Access

resource "aws_iam_user" "hub_system_user" {
name = "hub_system_user"
}

resource "aws_iam_access_key" "hub_system_user" {
user = aws_iam_user.hub_system_user.name
}

resource "aws_iam_user_policy" "hub_system_user_policy" {
name = "hub_system_user_policy"
user = aws_iam_user.hub_system_user.name

policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:Get*",
"s3:List*"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::meltano-squared-prod/hub_metrics/*"
}
]
}
EOF
}

### Squared User - S3 Write Access

resource "aws_iam_user" "squared_system_user" {
name = "squared_system_user"
}

resource "aws_iam_access_key" "squared_system_user" {
user = aws_iam_user.squared_system_user.name
}

resource "aws_iam_user_policy" "squared_system_user_policy" {
name = "squared_system_user_policy"
user = aws_iam_user.squared_system_user.name

policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:Get*",
"s3:List*",
"s3:PutObject*"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::meltano-squared-prod/hub_metrics/*"
}
]
}
EOF
}

## Output IDs and Encrypted Secrets
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you planning to move these to 1Password after they are created? I tend to prefer to redirect secrets to SSM parameters, rather than output, so the TF can be safely executed in CI and everything stays self-contained. e.g. https://github.com/meltano/squared/blob/main/deploy/meltano/main.tf#L42


output "hub_system_user_secret" {
value = aws_iam_access_key.hub_system_user.encrypted_secret
}

output "hub_system_user_id" {
value = aws_iam_access_key.hub_system_user.id
}

output "squared_system_user_secret" {
value = aws_iam_access_key.squared_system_user.encrypted_secret
}

output "squared_system_user_id" {
value = aws_iam_access_key.squared_system_user.id
}