From d4878194a347f51a6d5a265697e77b00e7ef037a Mon Sep 17 00:00:00 2001 From: Tim Hartmann Date: Thu, 12 Oct 2017 16:20:00 -0400 Subject: [PATCH] formated with terraform fmt --- consulRdsCreateService.tf | 39 ++++++++++++++++++++------------------- main.tf | 1 + outputs.tf | 1 + variables.tf | 5 +++-- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/consulRdsCreateService.tf b/consulRdsCreateService.tf index dccc781..cf0060f 100644 --- a/consulRdsCreateService.tf +++ b/consulRdsCreateService.tf @@ -30,60 +30,61 @@ resource "aws_iam_role" "consul_rds" { EOF } - resource "aws_iam_role_policy_attachment" "xray_wo" { - role = "${aws_iam_role.consul_rds.name}" - policy_arn = "arn:aws:iam::aws:policy/AWSXrayWriteOnlyAccess" + role = "${aws_iam_role.consul_rds.name}" + policy_arn = "arn:aws:iam::aws:policy/AWSXrayWriteOnlyAccess" } resource "aws_iam_role_policy_attachment" "vpc_exec" { - role = "${aws_iam_role.consul_rds.name}" - policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole" + role = "${aws_iam_role.consul_rds.name}" + policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole" } resource "aws_iam_role_policy_attachment" "ec2_ro" { - role = "${aws_iam_role.consul_rds.name}" - policy_arn = "arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess" + role = "${aws_iam_role.consul_rds.name}" + policy_arn = "arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess" } resource "aws_iam_role_policy_attachment" "rds_ro" { - role = "${aws_iam_role.consul_rds.name}" - policy_arn = "arn:aws:iam::aws:policy/AmazonRDSReadOnlyAccess" + role = "${aws_iam_role.consul_rds.name}" + policy_arn = "arn:aws:iam::aws:policy/AmazonRDSReadOnlyAccess" } resource "aws_iam_role_policy_attachment" "lambda_ro" { - role = "${aws_iam_role.consul_rds.name}" - policy_arn = "arn:aws:iam::aws:policy/AWSLambdaReadOnlyAccess" + role = "${aws_iam_role.consul_rds.name}" + policy_arn = "arn:aws:iam::aws:policy/AWSLambdaReadOnlyAccess" } resource "aws_iam_role_policy_attachment" "lambda_basic_exec" { - role = "${aws_iam_role.consul_rds.name}" - policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + role = "${aws_iam_role.consul_rds.name}" + policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" } resource "aws_lambda_function" "consulRdsCreateService" { filename = "${path.module}/files/rds/consulRdsCreateService.zip" - function_name = "consulRdsCreateService-${var.env}" # env var + function_name = "consulRdsCreateService-${var.env}" # env var role = "${aws_iam_role.consul_rds.arn}" handler = "consulRdsCreateService.lambda_handler" source_code_hash = "${base64sha256(file("${path.module}/files/rds/consulRdsCreateService.zip"))}" runtime = "python2.7" timeout = "60" + vpc_config { subnet_ids = ["${var.subnets}"] security_group_ids = ["${var.rds_sg}"] } + tracing_config { mode = "Active" } } resource "aws_lambda_permission" "rds_allow_cloudwatch" { - statement_id = "AllowExecutionFromCloudWatch" - action = "lambda:InvokeFunction" - function_name = "${aws_lambda_function.consulRdsCreateService.function_name}" - principal = "events.amazonaws.com" - source_arn = "${aws_cloudwatch_event_rule.consul_rds.arn}" + statement_id = "AllowExecutionFromCloudWatch" + action = "lambda:InvokeFunction" + function_name = "${aws_lambda_function.consulRdsCreateService.function_name}" + principal = "events.amazonaws.com" + source_arn = "${aws_cloudwatch_event_rule.consul_rds.arn}" } resource "aws_cloudwatch_event_rule" "consul_rds" { diff --git a/main.tf b/main.tf index e69de29..8b13789 100644 --- a/main.tf +++ b/main.tf @@ -0,0 +1 @@ + diff --git a/outputs.tf b/outputs.tf index e69de29..8b13789 100644 --- a/outputs.tf +++ b/outputs.tf @@ -0,0 +1 @@ + diff --git a/variables.tf b/variables.tf index 37c8989..37bd100 100644 --- a/variables.tf +++ b/variables.tf @@ -1,4 +1,5 @@ variable "env" {} + variable "subnets" { type = "list" description = "List of VPC Subnets IDs used to do lambdas" @@ -10,8 +11,8 @@ variable "rds_sg" { } variable "rds_vpc_ids" { - type = "list" - default = [] + type = "list" + default = [] description = "List of VPC ID's the consulRdsCreateService lambda will attempt to discover RDS instances in. Defaults empty array" }