Skip to content

Commit 3228982

Browse files
committed
terraform/AWS: Finish alphabetizing vars.tf
Clean up. Signed-off-by: Chuck Lever <[email protected]>
1 parent 463139c commit 3228982

File tree

2 files changed

+42
-69
lines changed

2 files changed

+42
-69
lines changed

terraform/aws/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ resource "aws_security_group" "kdevops_internal_group" {
6565

6666
resource "aws_key_pair" "kdevops_keypair" {
6767
key_name = var.ssh_keyname
68-
public_key = var.ssh_pubkey_data != "" ? var.ssh_pubkey_data : var.ssh_config_pubkey_file != "" ? file(var.ssh_config_pubkey_file) : ""
68+
public_key = var.ssh_config_pubkey_file != "" ? file(var.ssh_config_pubkey_file) : ""
6969
}
7070

7171
data "template_file" "script_user_data" {

terraform/aws/vars.tf

Lines changed: 41 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,10 @@
1-
# This is for North california, if you want another one:
2-
# https://docs.aws.amazon.com/general/latest/gr/rande.html
3-
variable "aws_region" {
4-
description = "Your preferred AWS region"
5-
type = string
6-
}
7-
8-
variable "aws_availability_zone" {
9-
description = "Your preferred AWS availability zone"
10-
type = string
11-
}
12-
13-
variable "ssh_keyname" {
14-
default = "kdevops_aws_key"
15-
description = "The name of your ssh key, this is just the name displayed and used on aws in the backend"
16-
type = string
17-
}
18-
19-
variable "ssh_pubkey_data" {
20-
default = ""
21-
description = "The ssh public key data"
22-
type = string
23-
}
24-
25-
# AMI updates for debian:
26-
# https://wiki.debian.org/Cloud/AmazonEC2Image/Stretch
27-
#
28-
# If you want to choose another distro:
29-
# https://letslearndevops.com/2018/08/23/terraform-get-latest-centos-ami/
30-
# To get filter values you can first setup aws cli:
31-
# https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html#cli-quick-configuration
32-
# Get your image ami id, for debian 9 amd64 on the us-west1 this is
33-
# ami-0adbaf2e0ce044437 so you can run:
34-
#
35-
# aws ec2 describe-images --image-ids ami-0adbaf2e0ce044437
36-
# For details:
37-
#
38-
# https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-images.html
39-
#
40-
# Using this filter glob lets us get the latest ami for this owner / release.
41-
variable "aws_name_search" {
42-
description = "Your AWS AMI search name filter"
43-
type = string
44-
}
45-
461
variable "aws_ami_owner" {
472
description = "An AWS AMI image owner or owner alias"
483
type = string
494
}
505

51-
# https://aws.amazon.com/ec2/instance-types/
52-
# Free trial limits you to 750 hours of only t2.micro
53-
variable "aws_instance_type" {
54-
description = "Your AWS instance type"
6+
variable "aws_availability_zone" {
7+
description = "Your preferred AWS availability zone"
558
type = string
569
}
5710

@@ -60,6 +13,12 @@ variable "aws_ebs_volumes_per_instance" {
6013
type = number
6114
}
6215

16+
variable "aws_ebs_volume_iops" {
17+
description = "IOPS reserved for each EBS volume"
18+
type = number
19+
default = null
20+
}
21+
6322
variable "aws_ebs_volume_size" {
6423
description = "Size in GiB for each of the volumes"
6524
type = number
@@ -76,10 +35,24 @@ variable "aws_ebs_volume_type" {
7635
type = string
7736
}
7837

79-
variable "aws_ebs_volume_iops" {
80-
description = "IOPS reserved for each EBS volume"
81-
type = number
82-
default = null
38+
variable "aws_instance_type" {
39+
description = "Your AWS instance type"
40+
type = string
41+
}
42+
43+
variable "aws_name_search" {
44+
description = "Your AWS AMI search name filter"
45+
type = string
46+
}
47+
48+
variable "aws_profile" {
49+
description = "Shared aws credentials file"
50+
type = string
51+
}
52+
53+
variable "aws_region" {
54+
description = "Your preferred AWS region"
55+
type = string
8356
}
8457

8558
# So far there hasn't been a need to configure this value
@@ -96,38 +69,38 @@ variable "aws_shared_credentials_file" {
9669
default = "~/.aws/credentials"
9770
}
9871

99-
# We had to use this as aws terraform provider doesn't have a way to set
100-
# the hostname. local-exec works too, but this is what we went with.
101-
variable "user_data_enabled" {
102-
description = "Do you want to enable cloud-init user data processing?"
72+
variable "ssh_keyname" {
73+
default = "kdevops_aws_key"
74+
description = "The name of your ssh key, this is just the name displayed and used on aws in the backend"
10375
type = string
104-
default = "yes"
10576
}
10677

107-
variable "user_data_log_dir" {
108-
description = "Where on the node you want user_data processing logs to go"
78+
variable "ssh_pubkey_data" {
79+
default = ""
80+
description = "The ssh public key data"
10981
type = string
110-
default = "/var/log/user_data"
11182
}
11283

113-
# Disable for non-systemd systems, you'll want to implement something that
114-
# does all what systemd does for us then if you still want your hostname
115-
# changed.
11684
variable "user_data_admin_enable_hostnamectl" {
11785
description = "Should we use hostnamectl to change the target hostname?"
11886
type = string
11987
default = "yes"
12088
}
12189

122-
# kdevops does want us to have the hostname there, yes... so this is required.
123-
# I forget which tests requires this.
12490
variable "user_data_admin_enable_host_file" {
12591
description = "Should /etc/hosts also be appended with the new hostname with the localhost address?"
12692
type = string
12793
default = "yes"
12894
}
12995

130-
variable "aws_profile" {
131-
description = "Shared aws credentials file"
96+
variable "user_data_enabled" {
97+
description = "Do you want to enable cloud-init user data processing?"
98+
type = string
99+
default = "yes"
100+
}
101+
102+
variable "user_data_log_dir" {
103+
description = "Where on the node you want user_data processing logs to go"
132104
type = string
105+
default = "/var/log/user_data"
133106
}

0 commit comments

Comments
 (0)