-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from fyde/big-bang
Add AWS ASG module
- Loading branch information
Showing
11 changed files
with
559 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.terraform | ||
terraform.tfstate | ||
*.tfstate* | ||
terraform.tfvars |
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,10 @@ | ||
--- | ||
repos: | ||
- repo: git://github.com/antonbabenko/pre-commit-terraform | ||
rev: v1.31.0 | ||
hooks: | ||
- id: terraform_fmt | ||
- id: terraform_validate | ||
- id: terraform_docs_replace | ||
- id: terraform_tflint | ||
- id: terraform_tfsec |
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,5 @@ | ||
# Change Log | ||
|
||
## v1.0.0 | ||
|
||
- [aws-asg] Initial release |
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 |
---|---|---|
@@ -1,2 +1,55 @@ | ||
# fyde-terraform | ||
Terraform modules for Fyde products | ||
# Fyde - Terraform modules | ||
|
||
![Fyde](https://raw.githubusercontent.com/fyde/docs/master/imgs/fyde-logo.png) | ||
|
||
Website: <https://fyde.com> | ||
|
||
Documentation: <https://fyde.github.io/docs> | ||
|
||
## Fyde Access Proxy | ||
|
||
### AWS - Auto Scaling Group | ||
|
||
Usage example: | ||
|
||
```yaml | ||
module "fyde-access-proxy" { | ||
source = "git::git@github.com:fyde/terraform-modules.git//modules/aws-asg?ref=v1.0.0" | ||
|
||
# Fyde Access Proxy | ||
fyde_access_proxy_public_port = 443 | ||
fyde_access_proxy_token = "replace_with_token" | ||
|
||
# AWS | ||
aws_region = "us-east-1" | ||
|
||
# Network Load Balancing | ||
nlb_subnets = ["subnet-public-1", "subnet-public-2", "subnet-public-3"] | ||
|
||
# Auto Scaling Group | ||
asg_desired_capacity = 3 | ||
asg_min_size = 3 | ||
asg_max_size = 3 | ||
asg_subnets = ["subnet-private-1", "subnet-private-2", "subnet-private-3"] | ||
|
||
# Launch Configuration | ||
launch_cfg_instance_type = "t2.small" | ||
launch_cfg_key_pair_name = "key_pair_name" | ||
} | ||
|
||
output "Network_Load_Balancer_DNS_Name" { | ||
value = module.fyde-access-proxy.Network_Load_Balancer_DNS_Name | ||
} | ||
|
||
output "Security_Group_for_Resources" { | ||
value = module.fyde-access-proxy.Security_Group_for_Resources | ||
} | ||
``` | ||
|
||
Check all the available variables [here](modules/aws-asg/README.md) | ||
|
||
## Misc | ||
|
||
- This repository has [pre-commit](https://github.com/antonbabenko/pre-commit-terraform) configured | ||
- Test all the pre-commit hooks with `pre-commit run -a` | ||
- Test branch with `git::git@github.com:fyde/terraform-modules.git//modules/aws-asg?ref=<branch-name>` |
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,40 @@ | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| terraform | ~> 0.12 | | ||
| aws | ~> 2 | | ||
| template | ~> 2 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| aws | ~> 2 | | ||
| null | n/a | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| asg\_desired\_capacity | The number of Amazon EC2 instances that should be running in the auto scaling group | `number` | `3` | no | | ||
| asg\_max\_size | The minimum size of the auto scaling group | `number` | `3` | no | | ||
| asg\_min\_size | The maximum size of the auto scaling group | `number` | `3` | no | | ||
| asg\_notification\_arn\_topic | Optional ARN topic to get Auto Scaling Group events | `string` | `""` | no | | ||
| asg\_subnets | A list of subnet IDs to launch resources in. Use Private Subnets with NAT Gateway configured or Public Subnets | `list` | n/a | yes | | ||
| aws\_region | AWS Region | `string` | n/a | yes | | ||
| fyde\_access\_proxy\_public\_port | Public port for this proxy (must match the value configured in the console for this proxy) | `number` | `443` | no | | ||
| fyde\_access\_proxy\_token | Fyde Access Proxy Token for this proxy (obtained from the console after proxy creation) | `any` | n/a | yes | | ||
| launch\_cfg\_associate\_public\_ip\_address | Associate a public ip address with an instance in a VPC | `bool` | `false` | no | | ||
| launch\_cfg\_instance\_type | The type of instance to use (t2.micro, t2.small, t2.medium, etc) | `string` | `"t2.small"` | no | | ||
| launch\_cfg\_key\_pair\_name | The name of the key pair to use | `string` | n/a | yes | | ||
| module\_version | Terraform module version | `string` | `"v1.0.0"` | no | | ||
| nlb\_enable\_cross\_zone\_load\_balancing | Configure cross zone load balancing for the NLB | `bool` | `false` | no | | ||
| nlb\_subnets | A list of public subnet IDs to attach to the LB. Use Public Subnets only | `list(string)` | n/a | yes | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| Network\_Load\_Balancer\_DNS\_Name | Update the Fyde Access Proxy in the Console with this DNS name | | ||
| Security\_Group\_for\_Resources | Use this group to allow Fyde Access Proxy access to internal resources | |
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 @@ | ||
# | ||
# Data | ||
# | ||
|
||
data "aws_caller_identity" "current" {} | ||
|
||
data "aws_subnet" "vpc_from_first_subnet" { | ||
id = var.nlb_subnets[0] | ||
} |
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,24 @@ | ||
# | ||
# Locals | ||
# | ||
|
||
locals { | ||
|
||
common_tags_map = { | ||
application = "fyde-access-proxy" | ||
"module_version" = var.module_version | ||
"disclaimer" = "Created by terraform" | ||
} | ||
|
||
common_tags_asg = null_resource.tags_as_list_of_maps.*.triggers | ||
} | ||
|
||
resource "null_resource" "tags_as_list_of_maps" { | ||
count = length(keys(local.common_tags_map)) | ||
|
||
triggers = { | ||
"key" = keys(local.common_tags_map)[count.index] | ||
"value" = values(local.common_tags_map)[count.index] | ||
"propagate_at_launch" = true | ||
} | ||
} |
Oops, something went wrong.