-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Implement module for VPC flow logs #1
Conversation
iam.tf
Outdated
@@ -0,0 +1,43 @@ | |||
resource "aws_iam_role" "default" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always use the policy document instead of heredoc. https://www.terraform.io/docs/providers/aws/d/iam_policy_document.html
iam.tf
Outdated
name = "${module.vpc_label.id}" | ||
role = "${aws_iam_role.default.id}" | ||
|
||
policy = <<EOF |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use policy document
main.tf
Outdated
module "subnet_label" { | ||
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.2.2" | ||
namespace = "${var.namespace}" | ||
name = "subnet" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be an attribute
@osterman , I think repo should be renamed, because |
kinesis.tf
Outdated
module "kinesis_label" { | ||
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.2.2" | ||
namespace = "${var.namespace}" | ||
name = "kinesis" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't hardcode module names.
main.tf
Outdated
@@ -0,0 +1,58 @@ | |||
data "aws_region" "default" { | |||
current = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"true"
README.md
Outdated
```terraform | ||
module "flow_logs" { | ||
source = "git::https://github.com/cloudposse/terraform-aws-cloudwatch-flow-logs.git?ref=master" | ||
vpc_id = "vpc-d309abab" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use variables for vpc_id
, namespace
and stage
.
name
may be required too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's just example =\ and name
isn't required input
@comeanother , I'm prefer the current name |
kinesis.tf
Outdated
retention_period = "${var.retention_period}" | ||
shard_level_metrics = "${var.shard_level_metrics}" | ||
encryption_type = "${var.encryption_type}" | ||
kms_key_id = "${var.encryption_type}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a copy and paste error?
kinesis.tf
Outdated
} | ||
|
||
resource "aws_cloudwatch_log_subscription_filter" "default" { | ||
name = "${aws_cloudwatch_log_group.default.name}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aws_cloudwatch_log_group
name (/aws/lambda/example_lambda_name
) may be improper for resource name.
https://www.terraform.io/docs/providers/aws/r/cloudwatch_log_subscription_filter.html
We should use terraform-null-label
for resource names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aws_cloudwatch_log_group name (/aws/lambda/example_lambda_name) may be improper for resource name.
it doesn't matter
main.tf
Outdated
count = "${length(compact(var.subnet_ids))}" | ||
log_group_name = "${aws_cloudwatch_log_group.default.name}" | ||
iam_role_arn = "${aws_iam_role.log.arn}" | ||
subnet_id = "${element(var.subnet_ids, count.index)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use compact
here too for consistence.
Otherwise, empty elements will be enumerated.
main.tf
Outdated
count = "${length(compact(var.eni_ids))}" | ||
log_group_name = "${aws_cloudwatch_log_group.default.name}" | ||
iam_role_arn = "${aws_iam_role.log.arn}" | ||
subnet_id = "${element(var.eni_ids, count.index)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use compact
here too for consistence.
Otherwise, empty elements will be enumerated.
main.tf
Outdated
} | ||
|
||
module "log_group_label" { | ||
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.2.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 0.3.1
label module.
main.tf
Outdated
} | ||
|
||
module "vpc_label" { | ||
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.2.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 0.3.1
label module.
main.tf
Outdated
} | ||
|
||
module "subnet_label" { | ||
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.2.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 0.3.1
label module.
variables.tf
Outdated
variable "stage" { | ||
description = "Stage (e.g. `prod`, `dev`, `staging`)" | ||
type = "string" | ||
default = "dev" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop default value.
variables.tf
Outdated
variable "namespace" { | ||
description = "Namespace (e.g. `cp` or `cloudposse`)" | ||
type = "string" | ||
default = "cp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop default value.
variables.tf
Outdated
} | ||
|
||
variable "vpc_id" { | ||
default = "vpc-aceb27ca" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop default value.
variables.tf
Outdated
|
||
variable "enabled" { | ||
default = "true" | ||
description = "Set to false to prevent the module from creating anything " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop trailing whitespaces.
What
CloudWatch
Why
ACCEPT,REJECT, ALL
network logs