-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nikita Dugar
committed
Sep 27, 2019
1 parent
7a3ea9f
commit 8421ce5
Showing
11 changed files
with
272 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
provider "aws" { | ||
region = "eu-west-1" | ||
} | ||
|
||
module "vpc" { | ||
source = "git::https://github.com/clouddrove/terraform-aws-vpc.git?ref=tags/0.12.1" | ||
|
||
name = "vpc" | ||
application = "clouddrove" | ||
environment = "test" | ||
label_order = ["environment", "name", "application"] | ||
|
||
cidr_block = "172.16.0.0/16" | ||
} | ||
|
||
module "public_subnets" { | ||
source = "git::https://github.com/clouddrove/terraform-aws-subnet.git?ref=tags/0.12.1" | ||
|
||
name = "public-subnet" | ||
application = "clouddrove" | ||
environment = "test" | ||
label_order = ["environment", "name", "application"] | ||
|
||
availability_zones = ["eu-west-1c"] | ||
vpc_id = module.vpc.vpc_id | ||
cidr_block = module.vpc.vpc_cidr_block | ||
type = "public" | ||
igw_id = module.vpc.igw_id | ||
} | ||
|
||
module "security_group" { | ||
source = "git::https://github.com/clouddrove/terraform-aws-security-group.git?ref=tags/0.12.1" | ||
|
||
name = "ingress_security_groups" | ||
application = "clouddrove" | ||
environment = "test" | ||
label_order = ["environment", "name", "application"] | ||
|
||
vpc_id = module.vpc.vpc_id | ||
allowed_ip = ["0.0.0.0/0"] | ||
allowed_ports = [80, 443, 9200] | ||
} | ||
|
||
module "elasticsearch" { | ||
source = "git::https://github.com/clouddrove/terraform-aws-elasticsearch.git?ref=tags/0.12.0" | ||
name = "es" | ||
application = "clouddrove" | ||
environment = "test" | ||
label_order = ["environment", "name", "application"] | ||
domain_name = "clouddrove" | ||
enable_iam_service_linked_role = true | ||
security_group_ids = [module.security_group.security_group_ids] | ||
subnet_ids = tolist(module.public_subnets.public_subnet_id) | ||
elasticsearch_version = "7.1" | ||
instance_type = "t2.small.elasticsearch" | ||
instance_count = 1 | ||
iam_actions = ["es:ESHttpGet", "es:ESHttpPut", "es:ESHttpPost"] | ||
volume_size = 30 | ||
volume_type = "gp2" | ||
advanced_options = { | ||
"rest.action.multi.allow_explicit_index" = "true" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
output "arn" { | ||
value = module.elasticsearch.domain_arn | ||
description = "ARN of the Elasticsearch domain." | ||
} | ||
|
||
output "tags" { | ||
value = module.elasticsearch.tags | ||
description = "A mapping of tags to assign to the resource." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Managed By : CloudDrove | ||
// Description : This Terratest is used to test the Terraform Elasticsearch module. | ||
// Copyright @ CloudDrove. All Right Reserved. | ||
package test | ||
|
||
import ( | ||
"testing" | ||
"github.com/gruntwork-io/terratest/modules/terraform" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func Test(t *testing.T) { | ||
t.Parallel() | ||
|
||
terraformOptions := &terraform.Options{ | ||
// Source path of Terraform directory. | ||
TerraformDir: "../../_example/single-node", | ||
Upgrade: true, | ||
} | ||
|
||
// This will run 'terraform init' and 'terraform application' and will fail the test if any errors occur | ||
terraform.InitAndApply(t, terraformOptions) | ||
|
||
// To clean up any resources that have been created, run 'terraform destroy' towards the end of the test | ||
defer terraform.Destroy(t, terraformOptions) | ||
|
||
// To get the value of an output variable, run 'terraform output' | ||
Tags := terraform.OutputMap(t, terraformOptions, "tags") | ||
Arn := terraform.Output(t, terraformOptions, "arn") | ||
|
||
// Check that we get back the outputs that we expect | ||
assert.Equal(t, "clouddrove", Tags["Name"]) | ||
assert.Contains(t, Arn, "arn:aws:es") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.