Terraform module to provision infra that collates CloudWatch data into an s3 data lake cloudwatch
.
This project is 100% Open Source and licensed under the APACHE2.
Include this repository as a module in your existing Terraform code:
module "cloudwatch-s3" {
source = "jameswoolfenden/aws/cloudwatch-s3"
version = "v0.2.20"
cloudwatch_stream_name = var.cloudwatch_stream_name
log_bucket = var.log_bucket
region_desc = var.region_desc
filter_pattern = var.filter_pattern
log_group_name = aws_cloudwatch_log_group.example.name
kms_master_key_id = aws_kms_key.example.arn
}
Then see folder "example/examplea" for a worked example.
No requirements.
Name | Version |
---|---|
aws | n/a |
No modules.
Name | Description | Type | Default | Required |
---|---|---|---|---|
cloudwatch_stream_name | n/a | string |
n/a | yes |
filter_pattern | description | string |
n/a | yes |
kms_master_key_id | The KMS key id to use for Encryption | string |
n/a | yes |
log_bucket | n/a | string |
n/a | yes |
log_bucket_logging | Access bucket logging. | string |
null |
no |
log_bucket_mfa_delete | If you set this as the default its going to make it hard to delete | string |
"Disabled" |
no |
log_group_name | A log group to stream | list(any) |
n/a | yes |
region_desc | A string used to help name stuff doesnt have to be a region | string |
n/a | yes |
s3_events | Events to notify on | list |
[ |
no |
server_side_encryption | Encrypt at rest | bool |
true |
no |
sse_algorithm | The Encryption algorithm to use | string |
"aws:kms" |
no |
Name | Description |
---|---|
cloudwatch_bin | n/a |
cwlrolearn | n/a |
firehosearn | n/a |
This is the policy required to build this project:
The Terraform resource required is:
resource "aws_iam_policy" "terraform_pike" {
name_prefix = "terraform_pike"
path = "/"
description = "Pike Autogenerated policy from IAC"
policy = jsonencode({
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:DescribeAccountAttributes"
],
"Resource": [
"*"
]
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"firehose:CreateDeliveryStream",
"firehose:DeleteDeliveryStream",
"firehose:DescribeDeliveryStream",
"firehose:ListTagsForDeliveryStream"
],
"Resource": [
"*"
]
},
{
"Sid": "VisualEditor2",
"Effect": "Allow",
"Action": [
"iam:CreateRole",
"iam:DeleteRole",
"iam:DeleteRolePolicy",
"iam:GetRole",
"iam:GetRolePolicy",
"iam:ListAttachedRolePolicies",
"iam:ListInstanceProfilesForRole",
"iam:ListRolePolicies",
"iam:PassRole",
"iam:PutRolePolicy"
],
"Resource": [
"*"
]
},
{
"Sid": "VisualEditor3",
"Effect": "Allow",
"Action": [
"logs:DeleteSubscriptionFilter",
"logs:DescribeSubscriptionFilters",
"logs:PutSubscriptionFilter"
],
"Resource": [
"*"
]
},
{
"Sid": "VisualEditor4",
"Effect": "Allow",
"Action": [
"s3:CreateBucket",
"s3:DeleteBucket",
"s3:GetAccelerateConfiguration",
"s3:GetBucketAcl",
"s3:GetBucketCORS",
"s3:GetBucketLogging",
"s3:GetBucketNotification",
"s3:GetBucketObjectLockConfiguration",
"s3:GetBucketPolicy",
"s3:GetBucketPublicAccessBlock",
"s3:GetBucketRequestPayment",
"s3:GetBucketTagging",
"s3:GetBucketVersioning",
"s3:GetBucketWebsite",
"s3:GetEncryptionConfiguration",
"s3:GetIntelligentTieringConfiguration",
"s3:GetLifecycleConfiguration",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:GetReplicationConfiguration",
"s3:ListBucket",
"s3:PutBucketLogging",
"s3:PutBucketNotification",
"s3:PutBucketPolicy",
"s3:PutBucketPublicAccessBlock",
"s3:PutBucketVersioning",
"s3:PutEncryptionConfiguration",
"s3:PutIntelligentTieringConfiguration",
"s3:PutLifecycleConfiguration"
],
"Resource": [
"*"
]
},
{
"Sid": "VisualEditor5",
"Effect": "Allow",
"Action": [
"sns:CreateTopic",
"sns:DeleteTopic",
"sns:GetTopicAttributes",
"sns:ListTagsForResource",
"sns:SetTopicAttributes"
],
"Resource": [
"*"
]
}
]
})
}
Check out these related projects.
- terraform-aws-codebuild - Making a Build pipeline
Got a question?
File a GitHub issue.
Please use the issue tracker to report any bugs or file feature requests.
Copyright © 2019-2023 James Woolfenden
See LICENSE for full details.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.