Skip to content

Commit

Permalink
Fixed comment
Browse files Browse the repository at this point in the history
  • Loading branch information
tuteng committed Jan 7, 2025
1 parent a9e1dab commit 58db995
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
26 changes: 10 additions & 16 deletions modules/aws/volume-access/main.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
data "aws_caller_identity" "current" {}
locals {
external_id = (var.external_id != "" ? [{ test : "StringEquals", variable : "sts:ExternalId", values : [var.external_id] }] : [])
account_ids = distinct(concat(var.account_ids, local.default_account_ids))
bucket_list = distinct([for item in var.buckets : "arn:aws:s3:::${split("/", item)[0]}"])
bucket_path_list = distinct([for item in var.buckets: "arn:aws:s3:::${item}"])
tag_set = merge({ Vendor = "StreamNative", Module = "StreamNative Volume", SNVersion = var.sn_policy_version }, var.tags)
external_id = (var.external_id != "" ? [{ test : "StringEquals", variable : "sts:ExternalId", values : [var.external_id] }] : [])
account_ids = distinct(concat(var.account_ids, local.default_account_ids))
bucket_list = distinct([for item in var.buckets : "arn:aws:s3:::${split("/", item)[0]}"])
bucket_path_list = distinct([for item in var.buckets : "arn:aws:s3:::${item}"])
tag_set = merge({ Vendor = "StreamNative", Module = "StreamNative Volume", SNVersion = var.sn_policy_version }, var.tags)
default_account_ids = compact([
# will add it in the next pr
])
Expand Down Expand Up @@ -65,10 +65,9 @@ data "aws_iam_policy_document" "streamnative_management_access" {
######
#-- Create the IAM role for the the StreamNative Cloud data access to s3 bucket
######
resource "aws_iam_policy" "access_bucket_role" {
name = "${var.role}"
description = "This policy sets the limits for the access s3 bucket for StreamNative's vendor access."
path = "/StreamNative/"
resource "aws_iam_role_policy" "access_bucket_role" {
name = var.role
role = var.role
policy = jsonencode({
"Version" : "2012-10-17",
"Statement" : [
Expand All @@ -86,7 +85,7 @@ resource "aws_iam_policy" "access_bucket_role" {
"s3:GetObject",
"s3:DeleteObject"
],
"Resource" : [for item in local.bucket_path_list: "${item}/*"]
"Resource" : [for item in local.bucket_path_list : "${item}/*"]
},
{
"Effect" : "Allow",
Expand All @@ -101,15 +100,10 @@ resource "aws_iam_policy" "access_bucket_role" {
}

resource "aws_iam_role" "access_bucket_role" {
name = "${var.role}"
name = var.role
description = "This role is used by StreamNative for the access s3 bucket."
assume_role_policy = data.aws_iam_policy_document.streamnative_management_access.json
path = "/StreamNative/"
tags = local.tag_set
max_session_duration = 43200
}

resource "aws_iam_role_policy_attachment" "access_bucket_role" {
policy_arn = aws_iam_policy.access_bucket_role.arn
role = aws_iam_role.access_bucket_role.name
}
8 changes: 4 additions & 4 deletions modules/aws/volume-access/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ variable "tags" {
}

variable "buckets" {
default = []
default = []
description = "User bucket and path name"
type = list(string)
}

variable "role" {
description = "Your aws iam role for access s3 bucket"
type = string
type = string
}

variable "account_ids" {
default = []
default = []
description = "Your account id"
type = list(string)
type = list(string)
}

0 comments on commit 58db995

Please sign in to comment.