@@ -201,3 +201,193 @@ config TERRAFORM_AWS_INSTANCE_TYPE
201201 default "i4i.metal" if TERRAFORM_AWS_INSTANCE_I4I_METAL
202202 default "c7a.8xlarge" if TERRAFORM_AWS_INSTANCE_C7A_8XLARGE
203203 default "c7a.metal-48xl" if TERRAFORM_AWS_INSTANCE_C7A_METAL_48XL
204+
205+ choice
206+ prompt "AWS AMI owner"
207+ default TERRAFORM_AWS_AMI_DEBIAN if DISTRO_DEBIAN
208+ default TERRAFORM_AWS_AMI_AMAZON_X86_64 if TARGET_ARCH_X86_64
209+ default TERRAFORM_AWS_AMI_AMAZON_ARM64 if TARGET_ARCH_ARM64
210+
211+ config TERRAFORM_AWS_AMI_DEBIAN
212+ bool "Debian"
213+ help
214+ This option will set AWS AMI owner to Debian.
215+
216+ config TERRAFORM_AWS_AMI_AMAZON_X86_64
217+ bool "Amazon Linux 2023 x86_64 - ami-0efa651876de2a5ce"
218+ depends on TARGET_ARCH_X86_64 && TERRAFORM_AWS_US_WEST_2
219+ help
220+ This option will set AWS AMI owner to Amazon EC2 images for x86_64.
221+
222+ config TERRAFORM_AWS_AMI_AMAZON_ARM64
223+ bool "Amazon Linux 2023 ARM64 - ami-0699f753302dd8b00"
224+ depends on TARGET_ARCH_ARM64 && TERRAFORM_AWS_US_WEST_2
225+ help
226+ This option will set AWS AMI owner to Amazon EC2 images for arm64.
227+
228+ config TERRAFORM_AWS_FEDORA40_X86_64
229+ bool "Fedora 40 on x86_64"
230+ depends on TARGET_ARCH_X86_64
231+ help
232+ This option sets the AWS AMI owner to Fedora 40 for x86_64.
233+
234+ config TERRAFORM_AWS_FEDORA40_ARM64
235+ bool "Fedora 40 on aarch64"
236+ depends on TARGET_ARCH_ARM64
237+ help
238+ This option sets the AWS AMI owner to Fedora 40 for ARM 64-bit.
239+
240+ config TERRAFORM_AWS_FEDORA41_X86_64
241+ bool "Fedora 41 on x86_64"
242+ depends on TARGET_ARCH_X86_64
243+ help
244+ This option sets the AWS AMI owner to Fedora 41 for x86_64.
245+
246+ config TERRAFORM_AWS_FEDORA41_ARM64
247+ bool "Fedora 41 on aarch64"
248+ depends on TARGET_ARCH_ARM64
249+ help
250+ This option sets the AWS AMI owner to Fedora 41 for ARM 64-bit.
251+
252+ config TERRAFORM_AWS_RHEL9_X86_64
253+ bool "RHEL9 x86_64"
254+ depends on TARGET_ARCH_X86_64
255+ help
256+ This option will set AWS AMI owner to RHEL9 for x86_64.
257+
258+ config TERRAFORM_AWS_RHEL9_ARM64
259+ bool "RHEL9 ARM 64"
260+ depends on TARGET_ARCH_ARM64
261+ help
262+ This option will set AWS AMI owner to RHEL9 for ARM64
263+
264+ config TERRAFORM_AWS_SLE15_SP4_X86_64
265+ bool "SUSE Linux Enterprise Server 15 SP4 x86_64 - ami-079ba66a5e9f2b70e"
266+ depends on TARGET_ARCH_X86_64 && TERRAFORM_AWS_US_WEST_2
267+ help
268+ This option will set AWS AMI owner to SLE15-SP4 for x86_64.
269+
270+ config TERRAFORM_AWS_SLE15_SP4_ARM64
271+ bool "SUSE Linux Enterprise Server 15 SP4 ARM64 - ami-00f902c807805f51a"
272+ depends on TARGET_ARCH_ARM64 && TERRAFORM_AWS_US_WEST_2
273+ help
274+ This option will set AWS AMI owner to SLE15-SP4 for arm64.
275+
276+ endchoice
277+
278+ if TERRAFORM_AWS_AMI_DEBIAN
279+
280+ choice
281+ prompt "AWS debian release to use"
282+ default TERRAFORM_AWS_NS_DEBIAN_12_X86_64 if TARGET_ARCH_X86_64
283+ default TERRAFORM_AWS_NS_DEBIAN_12_ARM64 if TARGET_ARCH_ARM64
284+
285+ config TERRAFORM_AWS_NS_DEBIAN_12_X86_64
286+ bool "Debian 12 - Bookworm x86_64"
287+ depends on TARGET_ARCH_X86_64
288+ help
289+ This option will set aws name search to debian-12-hvm-amd64-*
290+ Note, to expand on this get the AMI owner ID and then you can
291+ see what is available with something like this:
292+
293+ aws ec2 describe-images --owners 136693071363 --query 'Images[*].[Description]'
294+
295+ In theory we should be able to just automate Kconfig language then
296+ for AWS for a distro using 'make dynconfig' on kdevops.
297+
298+ config TERRAFORM_AWS_NS_DEBIAN_12_ARM64
299+ bool "Debian 12 - Bookworm ARM64"
300+ depends on TARGET_ARCH_ARM64
301+ help
302+ This option will set aws name search to debian-12-hvm-arm64-*
303+
304+ config TERRAFORM_AWS_NS_DEBIAN_11_X86_64
305+ bool "Debian 11 - Bullseye x86_64"
306+ depends on TARGET_ARCH_X86_64
307+ help
308+ This option will set aws name search to debian-11-hvm-amd64-*
309+
310+ config TERRAFORM_AWS_NS_DEBIAN_11_ARM64
311+ bool "Debian 11 - Bullseye arm64"
312+ depends on TARGET_ARCH_ARM64
313+ help
314+ This option will set aws name search to debian-11-hvm-arm64-*
315+
316+ config TERRAFORM_AWS_NS_DEBIAN_STRETCH_X86_64
317+ bool "debian-stretch-hvm-x86_64-"
318+ depends on TARGET_ARCH_X86_64
319+ help
320+ This option will set aws name search to debian-stretch-hvm-x86_64-*
321+ This is no longer supported by the debian community.
322+
323+ config TERRAFORM_AWS_NS_DEBIAN_STRETCH_ARM64
324+ bool "debian-stretch-hvm-arm64-"
325+ depends on TARGET_ARCH_ARM64
326+ help
327+ This option will set aws name search to debian-stretch-hvm-arm64-*
328+ This is no longer supported by the debian community.
329+
330+ endchoice
331+
332+ config TERRAFORM_AWS_AMI_DEBIAN_OWNER
333+ string
334+ default "136693071363" if TERRAFORM_AWS_NS_DEBIAN_12_X86_64 || TERRAFORM_AWS_NS_DEBIAN_12_ARM64
335+ default "136693071363" if TERRAFORM_AWS_NS_DEBIAN_11_X86_64 || TERRAFORM_AWS_NS_DEBIAN_11_ARM64
336+ default "379101102735" if TERRAFORM_AWS_NS_DEBIAN_STRETCH_X86_64 || TERRAFORM_AWS_NS_DEBIAN_STRETCH_ARM64
337+
338+ endif
339+
340+ config TERRAFORM_AWS_AMI_OWNER
341+ string
342+ default TERRAFORM_AWS_AMI_DEBIAN_OWNER if TERRAFORM_AWS_AMI_DEBIAN
343+ default "137112412989" if TERRAFORM_AWS_AMI_AMAZON_X86_64 || TERRAFORM_AWS_AMI_AMAZON_ARM64
344+ default "309956199498" if TERRAFORM_AWS_RHEL9_X86_64 || TERRAFORM_AWS_RHEL9_ARM64
345+ default "013907871322" if TERRAFORM_AWS_SLE15_SP4_X86_64 || TERRAFORM_AWS_SLE15_SP4_ARM64
346+ default "125523088429" if TERRAFORM_AWS_FEDORA40_X86_64 || TERRAFORM_AWS_FEDORA40_ARM64
347+ default "125523088429" if TERRAFORM_AWS_FEDORA41_X86_64 || TERRAFORM_AWS_FEDORA41_ARM64
348+ help
349+ This option specifies the AWS AMI owner.
350+
351+ config TERRAFORM_AWS_NS
352+ string
353+ default "debian-12-amd64-*" if TERRAFORM_AWS_NS_DEBIAN_12_X86_64
354+ default "debian-12-arm64-*" if TERRAFORM_AWS_NS_DEBIAN_12_ARM64
355+ default "debian-11-amd64-*" if TERRAFORM_AWS_NS_DEBIAN_11_X86_64
356+ default "debian-11-arm64-*" if TERRAFORM_AWS_NS_DEBIAN_11_ARM64
357+ default "debian-stretch-hvm-x86_64-*" if TERRAFORM_AWS_NS_DEBIAN_STRETCH_X86_64
358+ default "debian-stretch-hvm-arm64-*" if TERRAFORM_AWS_NS_DEBIAN_STRETCH_ARM64
359+ default "al2023-*-x86_64" if TARGET_ARCH_X86_64 && TERRAFORM_AWS_AMI_AMAZON_X86_64
360+ default "al2023-*-arm64" if TARGET_ARCH_ARM64 && TERRAFORM_AWS_AMI_AMAZON_ARM64
361+ default "RHEL-9.*x86_64-*" if TERRAFORM_AWS_RHEL9_X86_64
362+ default "RHEL-9.*arm64-*" if TERRAFORM_AWS_RHEL9_ARM64
363+ default "Fedora-Cloud-Base-AmazonEC2.x86_64-40-*" if TERRAFORM_AWS_FEDORA40_X86_64
364+ default "Fedora-Cloud-Base-AmazonEC2.aarch64-40-*" if TERRAFORM_AWS_FEDORA40_ARM64
365+ default "Fedora-Cloud-Base-AmazonEC2.x86_64-41-*" if TERRAFORM_AWS_FEDORA41_X86_64
366+ default "Fedora-Cloud-Base-AmazonEC2.aarch64-41-*" if TERRAFORM_AWS_FEDORA41_ARM64
367+ default "suse-sles-15-sp4-*x86_64" if TARGET_ARCH_X86_64 && TERRAFORM_AWS_SLE15_SP4_X86_64
368+ default "suse-sles-15-sp4-*arm64" if TARGET_ARCH_ARM64 && TERRAFORM_AWS_SLE15_SP4_ARM64
369+ help
370+ This option will set aws image search to use. Using this filter glob
371+ lets us get the latest ami for this owner / release.
372+
373+ For debian updates you can use this list for AMI updates:
374+
375+ https://wiki.debian.org/Cloud/AmazonEC2Image/Stretch
376+
377+ If you want to expand on this list or just use a value yourself here
378+ read:
379+
380+ https://letslearndevops.com/2018/08/23/terraform-get-latest-centos-ami/
381+
382+ To get filter values you can first setup aws cli:
383+
384+ https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html#cli-quick-configuration
385+
386+ Get your image ami id, for debian 9 amd64 on the us-west1 this is
387+ ami-0adbaf2e0ce044437 so you can run:
388+
389+ aws ec2 describe-images --image-ids ami-0adbaf2e0ce044437 | grep Name
390+
391+ For details:
392+
393+ https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-images.html
0 commit comments