@@ -2527,104 +2527,103 @@ EOF
25272527// ElasticSearch associated with VPC
25282528var testAccKinesisFirehoseDeliveryStreamBaseElasticsearchVpcConfig = testAccKinesisFirehoseDeliveryStreamBaseConfig + `
25292529data "aws_availability_zones" "available" {
2530- state = "available"
2530+ state = "available"
25312531
2532- filter {
2533- name = "opt-in-status"
2534- values = ["opt-in-not-required"]
2532+ filter {
2533+ name = "opt-in-status"
2534+ values = ["opt-in-not-required"]
2535+ }
25352536 }
2536- }
25372537
2538- resource "aws_vpc" "elasticsearch_in_vpc" {
2539- cidr_block = "192.168.0.0/22"
2538+ resource "aws_vpc" "elasticsearch_in_vpc" {
2539+ cidr_block = "192.168.0.0/22"
25402540
2541- tags = {
2542- Name = "terraform-testacc-elasticsearch-domain-in-vpc"
2541+ tags = {
2542+ Name = "terraform-testacc-elasticsearch-domain-in-vpc"
2543+ }
25432544 }
2544- }
25452545
2546- resource "aws_subnet" "first" {
2547- vpc_id = "${ aws_vpc.elasticsearch_in_vpc.id}"
2548- availability_zone = "${ data.aws_availability_zones.available.names[0]}"
2549- cidr_block = "192.168.0.0/24"
2546+ resource "aws_subnet" "first" {
2547+ vpc_id = aws_vpc.elasticsearch_in_vpc.id
2548+ availability_zone = data.aws_availability_zones.available.names[0]
2549+ cidr_block = "192.168.0.0/24"
25502550
2551- tags = {
2552- Name = "tf-acc-elasticsearch-domain-in-vpc-first"
2551+ tags = {
2552+ Name = "tf-acc-elasticsearch-domain-in-vpc-first"
2553+ }
25532554 }
2554- }
25552555
2556- resource "aws_subnet" "second" {
2557- vpc_id = "${ aws_vpc.elasticsearch_in_vpc.id}"
2558- availability_zone = "${ data.aws_availability_zones.available.names[1]}"
2559- cidr_block = "192.168.1.0/24"
2556+ resource "aws_subnet" "second" {
2557+ vpc_id = aws_vpc.elasticsearch_in_vpc.id
2558+ availability_zone = data.aws_availability_zones.available.names[1]
2559+ cidr_block = "192.168.1.0/24"
25602560
2561- tags = {
2562- Name = "tf-acc-elasticsearch-domain-in-vpc-second"
2561+ tags = {
2562+ Name = "tf-acc-elasticsearch-domain-in-vpc-second"
2563+ }
25632564 }
2564- }
25652565
2566- resource "aws_security_group" "first" {
2567- vpc_id = "${aws_vpc.elasticsearch_in_vpc.id}"
2568- }
2569-
2570- resource "aws_security_group" "second" {
2571- vpc_id = "${aws_vpc.elasticsearch_in_vpc.id}"
2572- }
2573-
2574- resource "aws_elasticsearch_domain" "test_cluster" {
2575-
2576- domain_name = "es-test-%d"
2577-
2578- cluster_config {
2579- instance_count = 2
2580- zone_awareness_enabled = true
2581- instance_type = "t2.small.elasticsearch"
2566+ resource "aws_security_group" "first" {
2567+ vpc_id = aws_vpc.elasticsearch_in_vpc.id
25822568 }
2583-
2584- ebs_options {
2585- ebs_enabled = true
2586- volume_size = 10
2569+
2570+ resource "aws_security_group" "second" {
2571+ vpc_id = aws_vpc.elasticsearch_in_vpc.id
25872572 }
2588-
2589- vpc_options {
2590- security_group_ids = ["${aws_security_group.first.id}", "${aws_security_group.second.id}"]
2591- subnet_ids = ["${aws_subnet.first.id}", "${aws_subnet.second.id}"]
2573+
2574+ resource "aws_elasticsearch_domain" "test_cluster" {
2575+ domain_name = "es-test-%d"
2576+
2577+ cluster_config {
2578+ instance_count = 2
2579+ zone_awareness_enabled = true
2580+ instance_type = "t2.small.elasticsearch"
2581+ }
2582+
2583+ ebs_options {
2584+ ebs_enabled = true
2585+ volume_size = 10
2586+ }
2587+
2588+ vpc_options {
2589+ security_group_ids = [aws_security_group.first.id, aws_security_group.second.id]
2590+ subnet_ids = [aws_subnet.first.id, aws_subnet.second.id]
2591+ }
25922592 }
2593- }
2594-
2595- resource "aws_iam_role_policy" "firehose-elasticsearch" {
2596- name = "elasticsearch"
2597- role = "${aws_iam_role.firehose.id}"
2598- policy = <<EOF
2593+
2594+ resource "aws_iam_role_policy" "firehose-elasticsearch" {
2595+ name = "elasticsearch"
2596+ role = aws_iam_role.firehose.id
2597+ policy = <<EOF
25992598{
2600- "Version": "2012-10-17",
2601- "Statement": [
2602- {
2603- "Effect": "Allow",
2604- "Action": [
2605- "es:*"
2606- ],
2607- "Resource": [
2608- "${aws_elasticsearch_domain.test_cluster.arn}",
2609- "${aws_elasticsearch_domain.test_cluster.arn}/*"
2610- ]
2611- },
2612- {
2613- "Effect": "Allow",
2614- "Action": [
2615- "ec2:Describe*",
2616- "ec2:CreateNetworkInterface",
2617- "ec2:CreateNetworkInterfacePermission",
2618- "ec2:DeleteNetworkInterface"
2619- ],
2620- "Resource": [
2621- "*"
2622- ]
2623- }
2624- ]
2599+ "Version":"2012-10-17",
2600+ "Statement":[
2601+ {
2602+ "Effect":"Allow",
2603+ "Action":[
2604+ "es:*"
2605+ ],
2606+ "Resource":[
2607+ "${aws_elasticsearch_domain.test_cluster.arn}",
2608+ "${aws_elasticsearch_domain.test_cluster.arn}/*"
2609+ ]
2610+ },
2611+ {
2612+ "Effect":"Allow",
2613+ "Action":[
2614+ "ec2:Describe*",
2615+ "ec2:CreateNetworkInterface",
2616+ "ec2:CreateNetworkInterfacePermission",
2617+ "ec2:DeleteNetworkInterface"
2618+ ],
2619+ "Resource":[
2620+ "*"
2621+ ]
2622+ }
2623+ ]
26252624}
26262625EOF
2627- }
2626+ }
26282627`
26292628
26302629var testAccKinesisFirehoseDeliveryStreamConfig_ElasticsearchBasic = testAccKinesisFirehoseDeliveryStreamBaseElasticsearchConfig + `
@@ -2650,27 +2649,27 @@ resource "aws_kinesis_firehose_delivery_stream" "test" {
26502649
26512650var testAccKinesisFirehoseDeliveryStreamConfig_ElasticsearchVpcBasic = testAccKinesisFirehoseDeliveryStreamBaseElasticsearchVpcConfig + `
26522651resource "aws_kinesis_firehose_delivery_stream" "test" {
2653- depends_on = ["aws_iam_role_policy.firehose-elasticsearch"]
2654-
2655- name = "terraform-kinesis-firehose-es-%d"
2656- destination = "elasticsearch"
2657- s3_configuration {
2658- role_arn = "${aws_iam_role.firehose.arn}"
2659- bucket_arn = "${aws_s3_bucket.bucket.arn}"
2660- }
2661- elasticsearch_configuration {
2662- domain_arn = "${aws_elasticsearch_domain.test_cluster.arn}"
2663- role_arn = "${aws_iam_role.firehose.arn}"
2664- index_name = "test"
2665- type_name = "test"
2666-
2667- vpc_config {
2668- subnet_ids = ["${aws_subnet.first.id}", "${aws_subnet.second.id}"]
2669- security_group_ids = ["${aws_security_group.first.id}", "${aws_security_group.second.id}"]
2670- role_arn = "${aws_iam_role.firehose.arn}"
2671- }
2652+ depends_on = [aws_iam_role_policy.firehose-elasticsearch]
2653+
2654+ name = "terraform-kinesis-firehose-es-%d"
2655+ destination = "elasticsearch"
2656+ s3_configuration {
2657+ role_arn = aws_iam_role.firehose.arn
2658+ bucket_arn = aws_s3_bucket.bucket.arn
2659+ }
2660+ elasticsearch_configuration {
2661+ domain_arn = aws_elasticsearch_domain.test_cluster.arn
2662+ role_arn = aws_iam_role.firehose.arn
2663+ index_name = "test"
2664+ type_name = "test"
2665+
2666+ vpc_config {
2667+ subnet_ids = [aws_subnet.first.id, aws_subnet.second.id]
2668+ security_group_ids = [aws_security_group.first.id, aws_security_group.second.id]
2669+ role_arn = aws_iam_role.firehose.arn
2670+ }
2671+ }
26722672 }
2673- }
26742673`
26752674var testAccKinesisFirehoseDeliveryStreamConfig_ElasticsearchUpdate = testAccKinesisFirehoseDeliveryStreamBaseElasticsearchConfig + `
26762675resource "aws_kinesis_firehose_delivery_stream" "test" {
@@ -2709,37 +2708,37 @@ resource "aws_kinesis_firehose_delivery_stream" "test" {
27092708
27102709var testAccKinesisFirehoseDeliveryStreamConfig_ElasticsearchVpcUpdate = testAccKinesisFirehoseDeliveryStreamBaseElasticsearchVpcConfig + `
27112710resource "aws_kinesis_firehose_delivery_stream" "test" {
2712- depends_on = [" aws_iam_role_policy.firehose-elasticsearch" ]
2713-
2714- name = "terraform-kinesis-firehose-es-%d"
2715- destination = "elasticsearch"
2716- s3_configuration {
2717- role_arn = "${ aws_iam_role.firehose.arn}"
2718- bucket_arn = "${ aws_s3_bucket.bucket.arn}"
2719- }
2720- elasticsearch_configuration {
2721- domain_arn = "${ aws_elasticsearch_domain.test_cluster.arn}"
2722- role_arn = "${ aws_iam_role.firehose.arn}"
2723- index_name = "test"
2724- type_name = "test"
2725- buffering_interval = 500
2726- vpc_config {
2727- subnet_ids = ["${ aws_subnet.first.id}", "${ aws_subnet.second.id}" ]
2728- security_group_ids = ["${ aws_security_group.first.id}", "${ aws_security_group.second.id}" ]
2729- role_arn = "${ aws_iam_role.firehose.arn}"
2730- }
2731- processing_configuration {
2732- enabled = false
2733- processors {
2734- type = "Lambda"
2735- parameters {
2736- parameter_name = "LambdaArn"
2737- parameter_value = "${aws_lambda_function.lambda_function_test.arn}:$LATEST"
2738- }
2739- }
2740- }
2741- }
2742- }`
2711+ depends_on = [aws_iam_role_policy.firehose-elasticsearch]
2712+
2713+ name = "terraform-kinesis-firehose-es-%d"
2714+ destination = "elasticsearch"
2715+ s3_configuration {
2716+ role_arn = aws_iam_role.firehose.arn
2717+ bucket_arn = aws_s3_bucket.bucket.arn
2718+ }
2719+ elasticsearch_configuration {
2720+ domain_arn = aws_elasticsearch_domain.test_cluster.arn
2721+ role_arn = aws_iam_role.firehose.arn
2722+ index_name = "test"
2723+ type_name = "test"
2724+ buffering_interval = 500
2725+ vpc_config {
2726+ subnet_ids = [aws_subnet.first.id, aws_subnet.second.id]
2727+ security_group_ids = [aws_security_group.first.id, aws_security_group.second.id]
2728+ role_arn = aws_iam_role.firehose.arn
2729+ }
2730+ processing_configuration {
2731+ enabled = false
2732+ processors {
2733+ type = "Lambda"
2734+ parameters {
2735+ parameter_name = "LambdaArn"
2736+ parameter_value = "${aws_lambda_function.lambda_function_test.arn}:$LATEST"
2737+ }
2738+ }
2739+ }
2740+ }
2741+ }`
27432742
27442743func testAccKinesisFirehoseDeliveryStreamConfig_missingProcessingConfiguration (rInt int ) string {
27452744 return fmt .Sprintf (`
0 commit comments