@@ -83,168 +83,36 @@ source "terraform/aws/kconfigs/instance-types/Kconfig.im4gn"
8383source "terraform/aws/kconfigs/instance-types/Kconfig.c7a"
8484
8585choice
86- prompt "AWS AMI owner"
87- default TERRAFORM_AWS_AMI_DEBIAN if DISTRO_DEBIAN
88- default TERRAFORM_AWS_AMI_AMAZON_X86_64 if TARGET_ARCH_X86_64
89- default TERRAFORM_AWS_AMI_AMAZON_ARM64 if TARGET_ARCH_ARM64
90-
91- config TERRAFORM_AWS_AMI_DEBIAN
92- bool "Debian"
93- help
94- This option will set AWS AMI owner to Debian.
95-
96- config TERRAFORM_AWS_AMI_AMAZON_X86_64
97- bool "Amazon Linux 2023 x86_64 - ami-0efa651876de2a5ce"
98- depends on TARGET_ARCH_X86_64 && TERRAFORM_AWS_US_WEST_2
99- help
100- This option will set AWS AMI owner to Amazon EC2 images for x86_64.
101-
102- config TERRAFORM_AWS_AMI_AMAZON_ARM64
103- bool "Amazon Linux 2023 ARM64 - ami-0699f753302dd8b00"
104- depends on TARGET_ARCH_ARM64 && TERRAFORM_AWS_US_WEST_2
105- help
106- This option will set AWS AMI owner to Amazon EC2 images for arm64.
107-
108- config TERRAFORM_AWS_FEDORA40_X86_64
109- bool "Fedora 40 on x86_64"
110- depends on TARGET_ARCH_X86_64
86+ prompt "Linux distribution"
87+ default TERRAFORM_AWS_DISTRO_DEBIAN
11188 help
112- This option sets the AWS AMI owner to Fedora 40 for x86_64.
89+ Select a popular Linux distribution to install on your
90+ instances, or use the "Custom AMI image" selection to
91+ choose an image that is off the beaten path.
11392
114- config TERRAFORM_AWS_FEDORA40_ARM64
115- bool "Fedora 40 on aarch64"
116- depends on TARGET_ARCH_ARM64
117- help
118- This option sets the AWS AMI owner to Fedora 40 for ARM 64-bit.
119-
120- config TERRAFORM_AWS_FEDORA41_X86_64
121- bool "Fedora 41 on x86_64"
122- depends on TARGET_ARCH_X86_64
123- help
124- This option sets the AWS AMI owner to Fedora 41 for x86_64.
125-
126- config TERRAFORM_AWS_FEDORA41_ARM64
127- bool "Fedora 41 on aarch64"
128- depends on TARGET_ARCH_ARM64
129- help
130- This option sets the AWS AMI owner to Fedora 41 for ARM 64-bit.
131-
132- config TERRAFORM_AWS_RHEL9_X86_64
133- bool "RHEL9 x86_64"
134- depends on TARGET_ARCH_X86_64
135- help
136- This option will set AWS AMI owner to RHEL9 for x86_64.
137-
138- config TERRAFORM_AWS_RHEL9_ARM64
139- bool "RHEL9 ARM 64"
140- depends on TARGET_ARCH_ARM64
141- help
142- This option will set AWS AMI owner to RHEL9 for ARM64
143-
144- config TERRAFORM_AWS_SLE15_SP4_X86_64
145- bool "SUSE Linux Enterprise Server 15 SP4 x86_64 - ami-079ba66a5e9f2b70e"
146- depends on TARGET_ARCH_X86_64 && TERRAFORM_AWS_US_WEST_2
147- help
148- This option will set AWS AMI owner to SLE15-SP4 for x86_64.
149-
150- config TERRAFORM_AWS_SLE15_SP4_ARM64
151- bool "SUSE Linux Enterprise Server 15 SP4 ARM64 - ami-00f902c807805f51a"
152- depends on TARGET_ARCH_ARM64 && TERRAFORM_AWS_US_WEST_2
153- help
154- This option will set AWS AMI owner to SLE15-SP4 for arm64.
93+ config TERRAFORM_AWS_DISTRO_AMAZON
94+ bool "Amazon Linux"
15595
156- endchoice
157-
158- if TERRAFORM_AWS_AMI_DEBIAN
159-
160- choice
161- prompt "AWS debian release to use"
162- default TERRAFORM_AWS_NS_DEBIAN_12_X86_64 if TARGET_ARCH_X86_64
163- default TERRAFORM_AWS_NS_DEBIAN_12_ARM64 if TARGET_ARCH_ARM64
164-
165- config TERRAFORM_AWS_NS_DEBIAN_12_X86_64
166- bool "Debian 12 - Bookworm x86_64"
167- depends on TARGET_ARCH_X86_64
168- help
169- This option will set aws name search to debian-12-hvm-amd64-*
170- Note, to expand on this get the AMI owner ID and then you can
171- see what is available with something like this:
172-
173- aws ec2 describe-images --owners 136693071363 --query 'Images[*].[Description]'
96+ config TERRAFORM_AWS_DISTRO_DEBIAN
97+ bool "Debian"
17498
175- In theory we should be able to just automate Kconfig language then
176- for AWS for a distro using 'make dynconfig' on kdevops.
99+ config TERRAFORM_AWS_DISTRO_FEDORA
100+ bool "Fedora Core"
177101
178- config TERRAFORM_AWS_NS_DEBIAN_12_ARM64
179- bool "Debian 12 - Bookworm ARM64"
180- depends on TARGET_ARCH_ARM64
181- help
182- This option will set aws name search to debian-12-hvm-arm64-*
102+ config TERRAFORM_AWS_DISTRO_RHEL
103+ bool "Red Hat Enterprise Linux"
183104
184- config TERRAFORM_AWS_NS_DEBIAN_11_X86_64
185- bool "Debian 11 - Bullseye x86_64"
186- depends on TARGET_ARCH_X86_64
187- help
188- This option will set aws name search to debian-11-hvm-amd64-*
105+ config TERRAFORM_AWS_DISTRO_SLES
106+ bool "Suse Linux Enterprise Server"
189107
190- config TERRAFORM_AWS_NS_DEBIAN_11_ARM64
191- bool "Debian 11 - Bullseye arm64"
192- depends on TARGET_ARCH_ARM64
193- help
194- This option will set aws name search to debian-11-hvm-arm64-*
108+ config TERRAFORM_AWS_DISTRO_CUSTOM
109+ bool "Custom AMI image"
195110
196111endchoice
197112
198- endif
199-
200- config TERRAFORM_AWS_AMI_OWNER
201- string
202- default "136693071363" if TERRAFORM_AWS_NS_DEBIAN_11_X86_64 || TERRAFORM_AWS_NS_DEBIAN_11_ARM64
203- default "136693071363" if TERRAFORM_AWS_NS_DEBIAN_12_X86_64 || TERRAFORM_AWS_NS_DEBIAN_12_ARM64
204- default "137112412989" if TERRAFORM_AWS_AMI_AMAZON_X86_64 || TERRAFORM_AWS_AMI_AMAZON_ARM64
205- default "309956199498" if TERRAFORM_AWS_RHEL9_X86_64 || TERRAFORM_AWS_RHEL9_ARM64
206- default "013907871322" if TERRAFORM_AWS_SLE15_SP4_X86_64 || TERRAFORM_AWS_SLE15_SP4_ARM64
207- default "125523088429" if TERRAFORM_AWS_FEDORA40_X86_64 || TERRAFORM_AWS_FEDORA40_ARM64
208- default "125523088429" if TERRAFORM_AWS_FEDORA41_X86_64 || TERRAFORM_AWS_FEDORA41_ARM64
209-
210- config TERRAFORM_AWS_NS
211- string
212- default "debian-12-amd64-*" if TERRAFORM_AWS_NS_DEBIAN_12_X86_64
213- default "debian-12-arm64-*" if TERRAFORM_AWS_NS_DEBIAN_12_ARM64
214- default "debian-11-amd64-*" if TERRAFORM_AWS_NS_DEBIAN_11_X86_64
215- default "debian-11-arm64-*" if TERRAFORM_AWS_NS_DEBIAN_11_ARM64
216- default "al2023-*-x86_64" if TARGET_ARCH_X86_64 && TERRAFORM_AWS_AMI_AMAZON_X86_64
217- default "al2023-*-arm64" if TARGET_ARCH_ARM64 && TERRAFORM_AWS_AMI_AMAZON_ARM64
218- default "RHEL-9.*x86_64-*" if TERRAFORM_AWS_RHEL9_X86_64
219- default "RHEL-9.*arm64-*" if TERRAFORM_AWS_RHEL9_ARM64
220- default "Fedora-Cloud-Base-AmazonEC2.x86_64-40-*" if TERRAFORM_AWS_FEDORA40_X86_64
221- default "Fedora-Cloud-Base-AmazonEC2.aarch64-40-*" if TERRAFORM_AWS_FEDORA40_ARM64
222- default "Fedora-Cloud-Base-AmazonEC2.x86_64-41-*" if TERRAFORM_AWS_FEDORA41_X86_64
223- default "Fedora-Cloud-Base-AmazonEC2.aarch64-41-*" if TERRAFORM_AWS_FEDORA41_ARM64
224- default "suse-sles-15-sp4-*x86_64" if TARGET_ARCH_X86_64 && TERRAFORM_AWS_SLE15_SP4_X86_64
225- default "suse-sles-15-sp4-*arm64" if TARGET_ARCH_ARM64 && TERRAFORM_AWS_SLE15_SP4_ARM64
226- help
227- This option will set aws image search to use. Using this filter glob
228- lets us get the latest ami for this owner / release.
229-
230- For debian updates you can use this list for AMI updates:
231-
232- https://wiki.debian.org/Cloud/AmazonEC2Image/Stretch
233-
234- If you want to expand on this list or just use a value yourself here
235- read:
236-
237- https://letslearndevops.com/2018/08/23/terraform-get-latest-centos-ami/
238-
239- To get filter values you can first setup aws cli:
240-
241- https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html#cli-quick-configuration
242-
243- Get your image ami id, for debian 9 amd64 on the us-west1 this is
244- ami-0adbaf2e0ce044437 so you can run:
245-
246- aws ec2 describe-images --image-ids ami-0adbaf2e0ce044437 | grep Name
247-
248- For details:
249-
250- https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-images.html
113+ source "terraform/aws/kconfigs/distros/Kconfig.amazon"
114+ source "terraform/aws/kconfigs/distros/Kconfig.debian"
115+ source "terraform/aws/kconfigs/distros/Kconfig.fedora"
116+ source "terraform/aws/kconfigs/distros/Kconfig.rhel"
117+ source "terraform/aws/kconfigs/distros/Kconfig.sles"
118+ source "terraform/aws/kconfigs/distros/Kconfig.custom"
0 commit comments