Skip to content

Commit cc35145

Browse files
committed
terraform/AWS: Rename the Kconfig symbols for availability zones
Amazon uses the terminology "availability zone" and not "availability region". As we rename the Kconfig symbols, let's include the continent/nation in these since there is, say, an "AV_ZONE_EAST_1A" in several regions. These need to be distinct if we are to add regions and zones for other countries. Signed-off-by: Chuck Lever <[email protected]>
1 parent bd31e7b commit cc35145

File tree

5 files changed

+54
-58
lines changed

5 files changed

+54
-58
lines changed

playbooks/roles/gen_tfvars/templates/aws/terraform.tfvars.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
aws_profile = "{{ terraform_aws_profile }}"
22
aws_region = "{{ terraform_aws_region }}"
3-
aws_availability_region = "{{ terraform_aws_av_region }}"
3+
aws_availability_zone = "{{ terraform_aws_av_zone }}"
44
aws_name_search = "{{ terraform_aws_ns }}"
55
aws_ami_owner = "{{ terraform_aws_ami_owner }}"
66
aws_instance_type = "{{ terraform_aws_instance_type }}"

scripts/terraform.Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ KDEVOPS_MRPROPER += $(KDEVOPS_NODES)
4848
DEFAULT_DEPS_REQS_EXTRA_VARS += $(KDEVOPS_TFVARS)
4949

5050
ifeq (y,$(CONFIG_TERRAFORM_AWS))
51-
TERRAFORM_EXTRA_VARS += terraform_aws_av_region=$(subst ",,$(CONFIG_TERRAFORM_AWS_AV_REGION))
5251
TERRAFORM_EXTRA_VARS += terraform_aws_ami_owner=$(subst ",,$(CONFIG_TERRAFORM_AWS_AMI_OWNER))
5352
TERRAFORM_EXTRA_VARS += terraform_aws_ns='$(CONFIG_TERRAFORM_AWS_NS)'
5453
TERRAFORM_EXTRA_VARS += terraform_aws_instance_type=$(subst ",,$(CONFIG_TERRAFORM_AWS_INSTANCE_TYPE))

terraform/aws/kconfigs/Kconfig.location

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ choice
1414

1515
to list the Availability Zones that are enabled for your
1616
AWS account. Enter your selection from this list using the
17-
TERRAFORM_AWS_AV_REGION menu.
17+
TERRAFORM_AWS_AV_ZONE menu.
1818

1919
If you wish to expand on the region list, send a patch after
2020
reading this list:
@@ -90,38 +90,38 @@ config TERRAFORM_AWS_REGION
9090
if TERRAFORM_AWS_REGION_US_EAST_1
9191

9292
choice
93-
prompt "AWS East 1 availability zone to use"
94-
default TERRAFORM_AWS_AV_REGION_EAST_1A
93+
prompt "AWS availability zone"
94+
default TERRAFORM_AWS_AV_ZONE_US_EAST_1A
9595

96-
config TERRAFORM_AWS_AV_REGION_EAST_1A
96+
config TERRAFORM_AWS_AV_ZONE_US_EAST_1A
9797
bool "us-east-1a"
9898
help
99-
This option selects us-east-1a availability zone.
99+
This option selects the us-east-1a availability zone.
100100

101-
config TERRAFORM_AWS_AV_REGION_EAST_1B
101+
config TERRAFORM_AWS_AV_ZONE_US_EAST_1B
102102
bool "us-east-1b"
103103
help
104-
This option selects us-east-1b availability zone.
104+
This option selects the us-east-1b availability zone.
105105

106-
config TERRAFORM_AWS_AV_REGION_EAST_1C
106+
config TERRAFORM_AWS_AV_ZONE_US_EAST_1C
107107
bool "us-east-1c"
108108
help
109-
This option selects us-east-1c availability zone.
109+
This option selects the us-east-1c availability zone.
110110

111-
config TERRAFORM_AWS_AV_REGION_EAST_1D
111+
config TERRAFORM_AWS_AV_ZONE_US_EAST_1D
112112
bool "us-east-1d"
113113
help
114-
This option selects us-east-1d availability zone.
114+
This option selects the us-east-1d availability zone.
115115

116-
config TERRAFORM_AWS_AV_REGION_EAST_1E
116+
config TERRAFORM_AWS_AV_ZONE_US_EAST_1E
117117
bool "us-east-1e"
118118
help
119-
This option selects us-east-1e availability zone.
119+
This option selects the us-east-1e availability zone.
120120

121-
config TERRAFORM_AWS_AV_REGION_EAST_1F
121+
config TERRAFORM_AWS_AV_ZONE_US_EAST_1F
122122
bool "us-east-1f"
123123
help
124-
This option selects us-east-1f availability zone.
124+
This option selects the us-east-1f availability zone.
125125

126126
endchoice
127127

@@ -130,23 +130,23 @@ endif # TERRAFORM_AWS_REGION_US_EAST_1
130130
if TERRAFORM_AWS_REGION_US_EAST_2
131131

132132
choice
133-
prompt "AWS East 2 availability zone to use"
134-
default TERRAFORM_AWS_AV_REGION_EAST_2A
133+
prompt "AWS availability zone"
134+
default TERRAFORM_AWS_AV_ZONE_US_EAST_2A
135135

136-
config TERRAFORM_AWS_AV_REGION_EAST_2A
136+
config TERRAFORM_AWS_AV_ZONE_US_EAST_2A
137137
bool "us-east-2a"
138138
help
139-
This option selects us-east-2a availability zone.
139+
This option selects the us-east-2a availability zone.
140140

141-
config TERRAFORM_AWS_AV_REGION_EAST_2B
141+
config TERRAFORM_AWS_AV_ZONE_US_EAST_2B
142142
bool "us-east-2b"
143143
help
144-
This option selects us-east-2a availability zone.
144+
This option selects the us-east-2a availability zone.
145145

146-
config TERRAFORM_AWS_AV_REGION_EAST_2C
146+
config TERRAFORM_AWS_AV_ZONE_US_EAST_2C
147147
bool "us-east-2c"
148148
help
149-
This option selects us-east-2c availability zone.
149+
This option selects the us-east-2c availability zone.
150150

151151
endchoice
152152

@@ -155,47 +155,47 @@ endif # TERRAFORM_AWS_REGION_US_EAST_2
155155
if TERRAFORM_AWS_REGION_US_WEST_2
156156

157157
choice
158-
prompt "AWS West 2 AV region to use"
159-
default TERRAFORM_AWS_AV_REGION_WEST_2B
160-
161-
config TERRAFORM_AWS_AV_REGION_WEST_1B
162-
bool "us-west-1b"
158+
prompt "AWS availability zone"
159+
default TERRAFORM_AWS_AV_ZONE_US_WEST_2B
163160
help
164-
This option will set the AWS AV region to us-west-1b.
165-
This option will set the AWS availablity region to the specified
166-
value.
167-
161+
This option sets the AWS availablity zone to the specified value.
168162
If you wish to expand on this list send a patch after reading this
169163
list:
170164

171165
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html
172166
https://gist.github.com/neilstuartcraig/0ccefcf0887f29b7f240
173167

174-
config TERRAFORM_AWS_AV_REGION_WEST_2B
168+
config TERRAFORM_AWS_AV_ZONE_US_WEST_1B
169+
bool "us-west-1b"
170+
help
171+
This option selects the us-west-1b availability zone.
172+
173+
config TERRAFORM_AWS_AV_ZONE_US_WEST_2B
175174
bool "us-west-2b"
176175
help
177-
This option will set the AWS AV region to us-west-2b.
176+
This option selects the us-west-2b availability zone.
178177

179-
config TERRAFORM_AWS_AV_REGION_WEST_2D
178+
config TERRAFORM_AWS_AV_ZONE_US_WEST_2D
180179
bool "us-west-2d"
181180
help
182-
This option will set the AWS AV region to us-west-2d.
181+
This option selects the us-west-2d availability zone.
183182

184183
endchoice
185184

186185
endif # TERRAFORM_AWS_REGION_US_WEST_2
187186

188-
config TERRAFORM_AWS_AV_REGION
187+
config TERRAFORM_AWS_AV_ZONE
189188
string
190-
default "us-west-1b" if TERRAFORM_AWS_AV_REGION_WEST_1B
191-
default "us-west-2b" if TERRAFORM_AWS_AV_REGION_WEST_2B
192-
default "us-west-2d" if TERRAFORM_AWS_AV_REGION_WEST_2D
193-
default "us-east-1a" if TERRAFORM_AWS_AV_REGION_EAST_1A
194-
default "us-east-1b" if TERRAFORM_AWS_AV_REGION_EAST_1B
195-
default "us-east-1c" if TERRAFORM_AWS_AV_REGION_EAST_1C
196-
default "us-east-1d" if TERRAFORM_AWS_AV_REGION_EAST_1D
197-
default "us-east-1e" if TERRAFORM_AWS_AV_REGION_EAST_1E
198-
default "us-east-1f" if TERRAFORM_AWS_AV_REGION_EAST_1F
199-
default "us-east-2a" if TERRAFORM_AWS_AV_REGION_EAST_2A
200-
default "us-east-2b" if TERRAFORM_AWS_AV_REGION_EAST_2B
201-
default "us-east-2c" if TERRAFORM_AWS_AV_REGION_EAST_2C
189+
output yaml
190+
default "us-east-1a" if TERRAFORM_AWS_AV_ZONE_US_EAST_1A
191+
default "us-east-1b" if TERRAFORM_AWS_AV_ZONE_US_EAST_1B
192+
default "us-east-1c" if TERRAFORM_AWS_AV_ZONE_US_EAST_1C
193+
default "us-east-1d" if TERRAFORM_AWS_AV_ZONE_US_EAST_1D
194+
default "us-east-1e" if TERRAFORM_AWS_AV_ZONE_US_EAST_1E
195+
default "us-east-1f" if TERRAFORM_AWS_AV_ZONE_US_EAST_1F
196+
default "us-east-2a" if TERRAFORM_AWS_AV_ZONE_US_EAST_2A
197+
default "us-east-2b" if TERRAFORM_AWS_AV_ZONE_US_EAST_2B
198+
default "us-east-2c" if TERRAFORM_AWS_AV_ZONE_US_EAST_2C
199+
default "us-west-1b" if TERRAFORM_AWS_AV_ZONE_US_WEST_1B
200+
default "us-west-2b" if TERRAFORM_AWS_AV_ZONE_US_WEST_2B
201+
default "us-west-2d" if TERRAFORM_AWS_AV_ZONE_US_WEST_2D

terraform/aws/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ resource "aws_vpc" "kdevops_vpc" {
2323
resource "aws_subnet" "kdevops_subnet" {
2424
cidr_block = cidrsubnet(aws_vpc.kdevops_vpc.cidr_block, 3, 1)
2525
vpc_id = aws_vpc.kdevops_vpc.id
26-
availability_zone = var.aws_availability_region
26+
availability_zone = var.aws_availability_zone
2727
}
2828

2929
resource "aws_security_group" "kdevops_sec_group" {
@@ -141,7 +141,7 @@ resource "aws_instance" "kdevops_instance" {
141141
module "kdevops_ebs_volumes" {
142142
count = var.aws_enable_ebs == "true" ? local.kdevops_num_boxes : 0
143143
source = "./kdevops_ebs_volumes"
144-
vol_availability_zone = var.aws_availability_region
144+
vol_availability_zone = var.aws_availability_zone
145145
vol_count = var.aws_ebs_num_volumes_per_instance
146146
vol_instance_id = element(aws_instance.kdevops_instance.*.id, count.index)
147147
vol_iops = var.aws_ebs_volume_iops

terraform/aws/vars.tf

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ variable "aws_region" {
55
type = string
66
}
77

8-
# I got mine by an error output after using the same region as above
9-
# https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html
10-
# https://gist.github.com/neilstuartcraig/0ccefcf0887f29b7f240
11-
variable "aws_availability_region" {
12-
description = "Your preferred AWS region"
8+
variable "aws_availability_zone" {
9+
description = "Your preferred AWS availability zone"
1310
type = string
1411
}
1512

0 commit comments

Comments
 (0)