Skip to content

Commit eff37d8

Browse files
Override target group name (#63)
* Override target group name * Auto Format Co-authored-by: cloudpossebot <[email protected]>
1 parent e92fde8 commit eff37d8

File tree

8 files changed

+58
-37
lines changed

8 files changed

+58
-37
lines changed

.github/renovate.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
":preserveSemverRanges"
55
],
66
"labels": ["auto-update"],
7+
"dependencyDashboardAutoclose": true,
78
"enabledManagers": ["terraform"],
89
"terraform": {
910
"ignorePaths": ["**/context.tf", "examples/**"]
1011
}
1112
}
12-

README.md

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,25 @@ provider "aws" {
105105
}
106106
107107
module "vpc" {
108-
source = "git::https://github.com/cloudposse/terraform-aws-vpc.git?ref=tags/0.8.1"
108+
source = "cloudposse/vpc/aws"
109+
# Cloud Posse recommends pinning every module to a specific version
110+
# version = "x.x.x"
111+
109112
namespace = var.namespace
110113
stage = var.stage
111114
name = var.name
112115
delimiter = var.delimiter
113116
attributes = var.attributes
114117
cidr_block = var.vpc_cidr_block
118+
115119
tags = var.tags
116120
}
117121
118122
module "subnets" {
119-
source = "git::https://github.com/cloudposse/terraform-aws-dynamic-subnets.git?ref=tags/0.16.1"
123+
source = "cloudposse/dynamic-subnets/aws"
124+
# Cloud Posse recommends pinning every module to a specific version
125+
# version = "x.x.x"
126+
120127
availability_zones = var.availability_zones
121128
namespace = var.namespace
122129
stage = var.stage
@@ -128,11 +135,15 @@ module "subnets" {
128135
cidr_block = module.vpc.vpc_cidr_block
129136
nat_gateway_enabled = false
130137
nat_instance_enabled = false
131-
tags = var.tags
138+
139+
tags = var.tags
132140
}
133141
134142
module "alb" {
135-
source = "git::https://github.com/cloudposse/terraform-aws-alb.git?ref=tags/0.7.0"
143+
source = "cloudposse/alb/aws"
144+
# Cloud Posse recommends pinning every module to a specific version
145+
# version = "x.x.x"
146+
136147
namespace = var.namespace
137148
stage = var.stage
138149
name = var.name
@@ -159,13 +170,15 @@ module "alb" {
159170
health_check_matcher = var.health_check_matcher
160171
target_group_port = var.target_group_port
161172
target_group_target_type = var.target_group_target_type
162-
tags = var.tags
173+
174+
tags = var.tags
163175
}
164176
165177
module "alb_ingress" {
166178
source = "cloudposse/alb-ingress/aws"
167179
# Cloud Posse recommends pinning every module to a specific version
168180
# version = "x.x.x"
181+
169182
namespace = var.namespace
170183
stage = var.stage
171184
name = var.name
@@ -180,7 +193,8 @@ module "alb_ingress" {
180193
default_target_group_enabled = false
181194
target_group_arn = module.alb.default_target_group_arn
182195
unauthenticated_listener_arns = [module.alb.http_listener_arn]
183-
tags = var.tags
196+
197+
tags = var.tags
184198
}
185199
```
186200

@@ -208,8 +222,6 @@ Available targets:
208222
|------|---------|
209223
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
210224
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.42 |
211-
| <a name="requirement_local"></a> [local](#requirement\_local) | >= 1.3 |
212-
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 2.0 |
213225

214226
## Providers
215227

@@ -300,6 +312,7 @@ Available targets:
300312
| <a name="input_stickiness_type"></a> [stickiness\_type](#input\_stickiness\_type) | The type of sticky sessions. The only current possible value is `lb_cookie` | `string` | `"lb_cookie"` | no |
301313
| <a name="input_tags"></a> [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).<br>Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no |
302314
| <a name="input_target_group_arn"></a> [target\_group\_arn](#input\_target\_group\_arn) | Existing ALB target group ARN. If provided, set `default_target_group_enabled` to `false` to disable creation of the default target group | `string` | `""` | no |
315+
| <a name="input_target_group_name"></a> [target\_group\_name](#input\_target\_group\_name) | Override the target group name | `string` | `""` | no |
303316
| <a name="input_target_type"></a> [target\_type](#input\_target\_type) | The type (`instance`, `ip` or `lambda`) of targets that can be registered with the target group | `string` | `"ip"` | no |
304317
| <a name="input_tenant"></a> [tenant](#input\_tenant) | ID element \_(Rarely used, not included by default)\_. A customer identifier, indicating who this instance of a resource is for | `string` | `null` | no |
305318
| <a name="input_unauthenticated_hosts"></a> [unauthenticated\_hosts](#input\_unauthenticated\_hosts) | Unauthenticated hosts to match in Hosts header | `list(string)` | `[]` | no |
@@ -462,8 +475,8 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
462475
### Contributors
463476

464477
<!-- markdownlint-disable -->
465-
| [![Erik Osterman][osterman_avatar]][osterman_homepage]<br/>[Erik Osterman][osterman_homepage] | [![Igor Rodionov][goruha_avatar]][goruha_homepage]<br/>[Igor Rodionov][goruha_homepage] | [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]<br/>[Andriy Knysh][aknysh_homepage] | [![Sarkis Varozian][sarkis_avatar]][sarkis_homepage]<br/>[Sarkis Varozian][sarkis_homepage] |
466-
|---|---|---|---|
478+
| [![Erik Osterman][osterman_avatar]][osterman_homepage]<br/>[Erik Osterman][osterman_homepage] | [![Igor Rodionov][goruha_avatar]][goruha_homepage]<br/>[Igor Rodionov][goruha_homepage] | [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]<br/>[Andriy Knysh][aknysh_homepage] | [![Sarkis Varozian][sarkis_avatar]][sarkis_homepage]<br/>[Sarkis Varozian][sarkis_homepage] | [![RB][nitrocode_avatar]][nitrocode_homepage]<br/>[RB][nitrocode_homepage] |
479+
|---|---|---|---|---|
467480
<!-- markdownlint-restore -->
468481

469482
[osterman_homepage]: https://github.com/osterman
@@ -474,6 +487,8 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
474487
[aknysh_avatar]: https://img.cloudposse.com/150x150/https://github.com/aknysh.png
475488
[sarkis_homepage]: https://github.com/sarkis
476489
[sarkis_avatar]: https://img.cloudposse.com/150x150/https://github.com/sarkis.png
490+
[nitrocode_homepage]: https://github.com/nitrocode
491+
[nitrocode_avatar]: https://img.cloudposse.com/150x150/https://github.com/nitrocode.png
477492

478493
[![README Footer][readme_footer_img]][readme_footer_link]
479494
[![Beacon][beacon]][website]

README.yaml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,25 @@ usage: |-
2828
}
2929
3030
module "vpc" {
31-
source = "git::https://github.com/cloudposse/terraform-aws-vpc.git?ref=tags/0.8.1"
31+
source = "cloudposse/vpc/aws"
32+
# Cloud Posse recommends pinning every module to a specific version
33+
# version = "x.x.x"
34+
3235
namespace = var.namespace
3336
stage = var.stage
3437
name = var.name
3538
delimiter = var.delimiter
3639
attributes = var.attributes
3740
cidr_block = var.vpc_cidr_block
41+
3842
tags = var.tags
3943
}
4044
4145
module "subnets" {
42-
source = "git::https://github.com/cloudposse/terraform-aws-dynamic-subnets.git?ref=tags/0.16.1"
46+
source = "cloudposse/dynamic-subnets/aws"
47+
# Cloud Posse recommends pinning every module to a specific version
48+
# version = "x.x.x"
49+
4350
availability_zones = var.availability_zones
4451
namespace = var.namespace
4552
stage = var.stage
@@ -51,11 +58,15 @@ usage: |-
5158
cidr_block = module.vpc.vpc_cidr_block
5259
nat_gateway_enabled = false
5360
nat_instance_enabled = false
54-
tags = var.tags
61+
62+
tags = var.tags
5563
}
5664
5765
module "alb" {
58-
source = "git::https://github.com/cloudposse/terraform-aws-alb.git?ref=tags/0.7.0"
66+
source = "cloudposse/alb/aws"
67+
# Cloud Posse recommends pinning every module to a specific version
68+
# version = "x.x.x"
69+
5970
namespace = var.namespace
6071
stage = var.stage
6172
name = var.name
@@ -82,13 +93,15 @@ usage: |-
8293
health_check_matcher = var.health_check_matcher
8394
target_group_port = var.target_group_port
8495
target_group_target_type = var.target_group_target_type
85-
tags = var.tags
96+
97+
tags = var.tags
8698
}
8799
88100
module "alb_ingress" {
89101
source = "cloudposse/alb-ingress/aws"
90102
# Cloud Posse recommends pinning every module to a specific version
91103
# version = "x.x.x"
104+
92105
namespace = var.namespace
93106
stage = var.stage
94107
name = var.name
@@ -103,9 +116,11 @@ usage: |-
103116
default_target_group_enabled = false
104117
target_group_arn = module.alb.default_target_group_arn
105118
unauthenticated_listener_arns = [module.alb.http_listener_arn]
106-
tags = var.tags
119+
120+
tags = var.tags
107121
}
108122
```
123+
109124
include:
110125
- docs/targets.md
111126
- docs/terraform.md
@@ -118,3 +133,5 @@ contributors:
118133
github: aknysh
119134
- name: Sarkis Varozian
120135
github: sarkis
136+
- name: RB
137+
github: nitrocode

docs/terraform.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
|------|---------|
66
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
77
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.42 |
8-
| <a name="requirement_local"></a> [local](#requirement\_local) | >= 1.3 |
9-
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 2.0 |
108

119
## Providers
1210

@@ -97,6 +95,7 @@
9795
| <a name="input_stickiness_type"></a> [stickiness\_type](#input\_stickiness\_type) | The type of sticky sessions. The only current possible value is `lb_cookie` | `string` | `"lb_cookie"` | no |
9896
| <a name="input_tags"></a> [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).<br>Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no |
9997
| <a name="input_target_group_arn"></a> [target\_group\_arn](#input\_target\_group\_arn) | Existing ALB target group ARN. If provided, set `default_target_group_enabled` to `false` to disable creation of the default target group | `string` | `""` | no |
98+
| <a name="input_target_group_name"></a> [target\_group\_name](#input\_target\_group\_name) | Override the target group name | `string` | `""` | no |
10099
| <a name="input_target_type"></a> [target\_type](#input\_target\_type) | The type (`instance`, `ip` or `lambda`) of targets that can be registered with the target group | `string` | `"ip"` | no |
101100
| <a name="input_tenant"></a> [tenant](#input\_tenant) | ID element \_(Rarely used, not included by default)\_. A customer identifier, indicating who this instance of a resource is for | `string` | `null` | no |
102101
| <a name="input_unauthenticated_hosts"></a> [unauthenticated\_hosts](#input\_unauthenticated\_hosts) | Unauthenticated hosts to match in Hosts header | `list(string)` | `[]` | no |

examples/complete/versions.tf

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 2.0"
8-
}
9-
null = {
10-
source = "hashicorp/null"
11-
version = ">= 2.0"
12-
}
13-
local = {
14-
source = "hashicorp/local"
15-
version = ">= 1.3"
7+
version = ">= 2.42"
168
}
179
}
1810
}

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ data "aws_lb_target_group" "default" {
1111
resource "aws_lb_target_group" "default" {
1212
count = module.this.enabled && var.default_target_group_enabled ? 1 : 0
1313

14-
name = module.this.id
14+
name = coalesce(var.target_group_name, module.this.id)
1515
port = var.port
1616
protocol = var.protocol
1717
slow_start = var.slow_start

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ variable "protocol" {
121121
description = "The protocol for the created ALB target group (if `target_group_arn` is not set)"
122122
}
123123

124+
variable "target_group_name" {
125+
type = string
126+
default = ""
127+
description = "Override the target group name"
128+
}
129+
124130
variable "target_type" {
125131
type = string
126132
default = "ip"

versions.tf

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,5 @@ terraform {
66
source = "hashicorp/aws"
77
version = ">= 2.42"
88
}
9-
null = {
10-
source = "hashicorp/null"
11-
version = ">= 2.0"
12-
}
13-
local = {
14-
source = "hashicorp/local"
15-
version = ">= 1.3"
16-
}
179
}
1810
}

0 commit comments

Comments
 (0)