Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/aws securitylake subscriber #35981

Merged
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions .changelog/35981.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
aws_securitylake_subscriber
```
57 changes: 4 additions & 53 deletions internal/service/securitylake/data_lake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ data "aws_caller_identity" "current" {}
data "aws_partition" "current" {}

resource "aws_iam_role" "meta_store_manager" {
name = "AmazonSecurityLakeMetaStoreManager"
name = "AmazonSecurityLakeMetaStoreManagerV2"
path = "/service-role/"
assume_role_policy = <<POLICY
{
Expand All @@ -364,58 +364,9 @@ resource "aws_iam_role" "meta_store_manager" {
POLICY
}

resource "aws_iam_role_policy" "meta_store_manager" {
name = "AmazonSecurityLakeMetaStoreManagerPolicy"
role = aws_iam_role.meta_store_manager.name

policy = <<POLICY
{
"Version": "2012-10-17",
"Statement": [{
"Sid": "AllowWriteLambdaLogs",
"Effect": "Allow",
"Action": [
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": [
"arn:${data.aws_partition.current.partition}:logs:*:${data.aws_caller_identity.current.account_id}:log-group:/aws/lambda/SecurityLake_Glue_Partition_Updater_Lambda*"
]
}, {
"Sid": "AllowCreateAwsCloudWatchLogGroup",
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup"
],
"Resource": [
"arn:${data.aws_partition.current.partition}:logs:*:${data.aws_caller_identity.current.account_id}:/aws/lambda/SecurityLake_Glue_Partition_Updater_Lambda*"
]
}, {
"Sid": "AllowGlueManage",
"Effect": "Allow",
"Action": [
"glue:CreatePartition",
"glue:BatchCreatePartition"
],
"Resource": [
"arn:${data.aws_partition.current.partition}:glue:*:*:table/amazon_security_lake_glue_db*/*",
"arn:${data.aws_partition.current.partition}:glue:*:*:database/amazon_security_lake_glue_db*",
"arn:${data.aws_partition.current.partition}:glue:*:*:catalog"
]
}, {
"Sid": "AllowToReadFromSqs",
"Effect": "Allow",
"Action": [
"sqs:ReceiveMessage",
"sqs:DeleteMessage",
"sqs:GetQueueAttributes"
],
"Resource": [
"arn:${data.aws_partition.current.partition}:sqs:*:${data.aws_caller_identity.current.account_id}:SecurityLake*"
]
}]
}
POLICY
resource "aws_iam_role_policy_attachment" "datalake" {
role = aws_iam_role.meta_store_manager.name
policy_arn = "arn:${data.aws_partition.current.partition}:iam::aws:policy/service-role/AmazonSecurityLakeMetastoreManager"
}

resource "aws_iam_role" "datalake_s3_replication" {
Expand Down
2 changes: 2 additions & 0 deletions internal/service/securitylake/exports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ var (
ResourceAWSLogSource = newAWSLogSourceResource
ResourceCustomLogSource = newCustomLogSourceResource
ResourceDataLake = newDataLakeResource
ResourceSubscriber = newSubscriberResource

FindAWSLogSourceBySourceName = findAWSLogSourceBySourceName
FindCustomLogSourceBySourceName = findCustomLogSourceBySourceName
FindDataLakeByARN = findDataLakeByARN
FindSubscriberByID = findSubscriberByID
)
7 changes: 7 additions & 0 deletions internal/service/securitylake/securitylake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ func TestAccSecurityLake_serial(t *testing.T) {
"lifecycleUpdate": testAccDataLake_lifeCycleUpdate,
"replication": testAccDataLake_replication,
},
"Subscriber": {
"basic": testAccSubscriber_basic,
"customLogs": testAccSubscriber_customLogSource,
"disappears": testAccSubscriber_disappears,
"tags": testAccSubscriber_tags,
"updated": testAccSubscriber_update,
},
}

acctest.RunSerialTests2Levels(t, testCases, 0)
Expand Down
7 changes: 7 additions & 0 deletions internal/service/securitylake/service_package_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading