diff --git a/.drone.yml b/.drone.yml index 57ba6ab..99133ab 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,7 +1,21 @@ -pipeline: - validate: - image: quay.io/ukhomeofficedigital/terraform-toolset:v0.12.6 - commands: - - /acp/scripts/tf-validate.sh --no-docs - when: - event: [pull_request, push] +--- +kind: pipeline +name: default +type: kubernetes + +platform: + os: linux + arch: amd64 + +steps: +- name: validate + pull: if-not-exists + image: quay.io/ukhomeofficedigital/terraform-toolset:v1.1.3-2 + commands: + - /acp/scripts/tf-validate.sh + when: + event: + - pull_request + - push + +... \ No newline at end of file diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl new file mode 100644 index 0000000..ee830c7 --- /dev/null +++ b/.terraform.lock.hcl @@ -0,0 +1,20 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/aws" { + version = "3.71.0" + hashes = [ + "h1:wnTd0krep3mqRz650U7TSv/tCkA0LoXKe0QFlnsg/7Q=", + "zh:173134d8861a33ed60a48942ad2b96b9d06e85c506d7f927bead47a28f4ebdd2", + "zh:2996c8e96930f526f1761e99d14c0b18d83e287b1362aa2fa1444cf848ece613", + "zh:43903da1e0a809a1fb5832e957dbe2321b86630d6bfdd8b47728647a72fd912d", + "zh:43e71fd8924e7f7b56a0b2a82e29edf07c53c2b41ee7bb442a2f1c27e03e86ae", + "zh:4f4c73711f64a3ff85f88bf6b2594e5431d996b7a59041ff6cbc352f069fc122", + "zh:5045241b8695ffbd0730bdcd91393b10ffd0cfbeaad6254036e42ead6687d8fd", + "zh:6a8811a0fb1035c09aebf1f9b15295523a9a7a2627fd783f50c6168a82e192dd", + "zh:8d273c04d7a8c36d4366329adf041c480a0f1be10a7269269c88413300aebdb8", + "zh:b90505897ae4943a74de2b88b6a9e7d97bf6dc325a0222235996580edff28656", + "zh:ea5e422942ac6fc958229d27d4381c89d21d70c5c2c67a6c06ff357bcded76f6", + "zh:f1536d7ff2d3bfd668e3ac33d8956b4f988f87fdfdcc371c7d94b98d5dba53e2", + ] +} diff --git a/README.md b/README.md index 9c9922c..2433aa1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ + Module usage: module "nlb" { @@ -5,60 +6,86 @@ Module usage: name = "my-service" environment = "dev" # by default both Name and Env is added to the tags - dns_zone = "example.com" - vpc_id = "vpc-32323232" + dns\_zone = "example.com" + vpc\_id = "vpc-32323232" tags = { - Role = "some_tag" + Role = "some\_tag" } # A series of tags applied to filter out the source subnets, by default Env and Role = elb-subnet is used - subnet_tags { - Role = "some_tag" + subnet\_tags { + Role = "some\_tag" } listeners = [ { port = "80" - target_port = "30200" - target_group = "compute" + target\_port = "30200" + target\_group = "compute" }, { port = "443" - target_port = "30201" - target_group = "compute" + target\_port = "30201" + target\_group = "compute" } ] } +## Requirements +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.0 | + +## Providers + +| Name | Version | +|------|---------| +| [aws](#provider\_aws) | 3.71.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [aws_autoscaling_attachment.asg_attachment](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/autoscaling_attachment) | resource | +| [aws_lb.balancer](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb) | resource | +| [aws_lb_listener.listeners](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener) | resource | +| [aws_lb_target_group.target_groups](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group) | resource | +| [aws_route53_record.dns](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource | +| [aws_route53_zone.selected](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) | data source | +| [aws_subnet_ids.selected](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) | data source | ## Inputs -| Name | Description | Default | Required | -|------|-------------|:-----:|:-----:| -| deregistration_delay | The amount time for Elastic Load Balancing to wait before changing the state of a deregistering target from draining to unused | `300` | no | -| dns_name | An optional hostname to add to the hosting zone, otherwise defaults to var.name | `` | no | -| dns_type | The dns record type to use when adding the dns entry | `A` | no | -| dns_zone | The AWS route53 domain name hosting the dns entry, i.e. example.com | - | yes | -| elb_role_tag | The role tag applied to the subnets used for ELB, i.e. Role = elb-subnet | `elb-subnets` | no | -| environment | An envionment name for the ELB, i.e. prod, dev, ci etc and used to search for assets | - | yes | -| health_check_interval | The interval between performing a health check | `30` | no | -| healthy_threshold | The number of consecutive health checks successes required before considering an unhealthy target healthy | `3` | no | -| idle_timeout | The timeout applie to idle ELB connections | `120` | no | -| internal | Indicates if the ELB should be an internal load balancer, defaults to true | `true` | no | -| listeners | An array of listeners to setup for the NLB | - | yes | -| name | A descriptive name for this ELB | - | yes | -| subnet_tags | A map of tags used to filter the subnets you want the ELB attached | `` | no | -| tags | A map of tags which will be added to the ELB cloud tags, by default Name, Env and KubernetesCluster is added | `` | no | -| unhealthy_threshold | The number of consecutive health check failures required before considering the target unhealthy | `3` | no | -| vpc_id | The VPC id you are building the network load balancer in | - | yes | +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [deregistration\_delay](#input\_deregistration\_delay) | The amount time for Elastic Load Balancing to wait before changing the state of a deregistering target from draining to unused | `string` | `"300"` | no | +| [dns\_name](#input\_dns\_name) | An optional hostname to add to the hosting zone, otherwise defaults to var.name | `string` | `""` | no | +| [dns\_type](#input\_dns\_type) | The dns record type to use when adding the dns entry | `string` | `"A"` | no | +| [dns\_zone](#input\_dns\_zone) | The AWS route53 domain name hosting the dns entry, i.e. example.com | `any` | n/a | yes | +| [elb\_role\_tag](#input\_elb\_role\_tag) | The role tag applied to the subnets used for ELB, i.e. Role = elb-subnet | `string` | `"elb-subnets"` | no | +| [environment](#input\_environment) | An envionment name for the ELB, i.e. prod, dev, ci etc and used to search for assets | `any` | n/a | yes | +| [health\_check\_interval](#input\_health\_check\_interval) | The interval between performing a health check | `string` | `"30"` | no | +| [healthy\_threshold](#input\_healthy\_threshold) | The number of consecutive health checks successes required before considering an unhealthy target healthy | `string` | `"3"` | no | +| [idle\_timeout](#input\_idle\_timeout) | The timeout applie to idle ELB connections | `string` | `"120"` | no | +| [internal](#input\_internal) | Indicates if the ELB should be an internal load balancer, defaults to true | `bool` | `true` | no | +| [listeners](#input\_listeners) | An array of listeners to setup for the NLB | `list(map(string))` | n/a | yes | +| [name](#input\_name) | A descriptive name for this ELB | `any` | n/a | yes | +| [subnet\_tags](#input\_subnet\_tags) | A map of tags used to filter the subnets you want the ELB attached | `map` | `{}` | no | +| [tags](#input\_tags) | A map of tags which will be added to the ELB cloud tags, by default Name, Env and KubernetesCluster is added | `map` | `{}` | no | +| [unhealthy\_threshold](#input\_unhealthy\_threshold) | The number of consecutive health check failures required before considering the target unhealthy | `string` | `"3"` | no | +| [vpc\_id](#input\_vpc\_id) | The VPC id you are building the network load balancer in | `any` | n/a | yes | ## Outputs | Name | Description | |------|-------------| -| dns | | -| nlb_arn | | -| nlb_dns_name | | -| nlb_id | | -| nlb_name | | - +| [dns](#output\_dns) | The FQDN of the newly created ELB | +| [nlb\_arn](#output\_nlb\_arn) | The AWS ARN of the NLB which has been created | +| [nlb\_dns\_name](#output\_nlb\_dns\_name) | The name given to the ELB just created | +| [nlb\_id](#output\_nlb\_id) | The ID for the ELB which has been created | +| [nlb\_name](#output\_nlb\_name) | The name of the network load balancer we are creating | + \ No newline at end of file diff --git a/main.tf b/main.tf index 9ca8792..637850b 100644 --- a/main.tf +++ b/main.tf @@ -32,7 +32,7 @@ * */ terraform { - required_version = ">= 0.12" + required_version = ">= 1.0" } # Get a list of ELB subnets