Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 56 additions & 2 deletions scripts/generate_cloud_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,52 @@ def get_lambdalabs_summary() -> tuple[bool, str]:
return False, "Lambda Labs: Error querying API - using defaults"


def generate_aws_kconfig() -> bool:
"""
Generate AWS Kconfig files.
Returns True on success, False on failure.
"""
script_dir = os.path.dirname(os.path.abspath(__file__))
project_root = os.path.dirname(script_dir)
aws_scripts_dir = os.path.join(project_root, "terraform", "aws", "scripts")
aws_kconfigs_dir = os.path.join(project_root, "terraform", "aws", "kconfigs")

# Define the script-to-output mapping
scripts_to_run = [
("gen_kconfig_ami", "Kconfig.ami"),
("gen_kconfig_instance", "Kconfig.instance"),
("gen_kconfig_location", "Kconfig.location"),
]

all_success = True

for script_name, kconfig_file in scripts_to_run:
script_path = os.path.join(aws_scripts_dir, script_name)
output_path = os.path.join(aws_kconfigs_dir, kconfig_file)

# Run the script and capture its output
result = subprocess.run(
[script_path],
capture_output=True,
text=True,
check=False,
)

if result.returncode == 0:
# Write the output to the corresponding Kconfig file
try:
with open(output_path, 'w') as f:
f.write(result.stdout)
except IOError as e:
print(f"Error writing {kconfig_file}: {e}", file=sys.stderr)
all_success = False
else:
print(f"Error running {script_name}: {result.stderr}", file=sys.stderr)
all_success = False

return all_success


def main():
"""Main function to generate cloud configurations."""
print("Cloud Provider Configuration Summary")
Expand All @@ -121,15 +167,23 @@ def main():
print(f"⚠ {summary}")
print()

# AWS (placeholder - not implemented)
print("⚠ AWS: Dynamic configuration not yet implemented")
# AWS - Generate Kconfig files
kconfig_generated = generate_aws_kconfig()
if kconfig_generated:
print("✓ AWS: Kconfig files generated successfully")
else:
print("⚠ AWS: Failed to generate Kconfig files - using defaults")
print()

# Azure (placeholder - not implemented)
print("⚠ Azure: Dynamic configuration not yet implemented")

# GCE (placeholder - not implemented)
print("⚠ GCE: Dynamic configuration not yet implemented")

# OCI (placeholder - not implemented)
print("⚠ OCI: Dynamic configuration not yet implemented")

print()
print("Note: Dynamic configurations query real-time availability")
print("Run 'make menuconfig' to configure your cloud provider")
Expand Down
24 changes: 14 additions & 10 deletions terraform/aws/kconfigs/Kconfig.ami
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ config TERRAFORM_AWS_AMI_OWNER
config TERRAFORM_AWS_NS
string
output yaml
default "AlmaLinux OS *" if TERRAFORM_AWS_AMI_ALMALINUX_10
default "AlmaLinux OS 8.*" if TERRAFORM_AWS_AMI_ALMALINUX_8
default "AlmaLinux OS Kitten 10.202509*" if TERRAFORM_AWS_AMI_ALMALINUX_10
default "AlmaLinux OS 8.10.202*" if TERRAFORM_AWS_AMI_ALMALINUX_8
default "almalinux9-x86_64-community-vmware-bundle" if TERRAFORM_AWS_AMI_ALMALINUX_9

endif # TERRAFORM_AWS_DISTRO_ALMALINUX
Expand Down Expand Up @@ -139,7 +139,7 @@ config TERRAFORM_AWS_AMI_OWNER
config TERRAFORM_AWS_NS
string
output yaml
default "amzn2-ami-*" if TERRAFORM_AWS_AMI_AMAZON_LINUX_2
default "amzn2-ami-minimal-*" if TERRAFORM_AWS_AMI_AMAZON_LINUX_2
default "al2023-ami-*" if TERRAFORM_AWS_AMI_AMAZON_LINUX_2023

endif # TERRAFORM_AWS_DISTRO_AMAZON
Expand Down Expand Up @@ -257,9 +257,9 @@ config TERRAFORM_AWS_NS
default "fedora-coreos-39.20240*" if TERRAFORM_AWS_AMI_FEDORA_39
default "fedora-coreos-40.202410*" if TERRAFORM_AWS_AMI_FEDORA_40
default "fedora-coreos-41.20250*" if TERRAFORM_AWS_AMI_FEDORA_41
default "fedora-coreos-42.202509*" if TERRAFORM_AWS_AMI_FEDORA_42
default "fedora-coreos-43.20250917.1*" if TERRAFORM_AWS_AMI_FEDORA_43
default "fedora-coreos-44.202509*" if TERRAFORM_AWS_AMI_FEDORA_44
default "fedora-coreos-42.202510*" if TERRAFORM_AWS_AMI_FEDORA_42
default "fedora-coreos-43.2025100*" if TERRAFORM_AWS_AMI_FEDORA_43
default "fedora-coreos-44.2025100*" if TERRAFORM_AWS_AMI_FEDORA_44

endif # TERRAFORM_AWS_DISTRO_FEDORA

Expand Down Expand Up @@ -322,9 +322,9 @@ config TERRAFORM_AWS_AMI_OWNER
config TERRAFORM_AWS_NS
string
output yaml
default "RHEL-10.0.0_HVM*" if TERRAFORM_AWS_AMI_RHEL_10
default "RHEL-10.0.0_HVM-20250*" if TERRAFORM_AWS_AMI_RHEL_10
default "RHEL-7.9_HVM-20240930-x86_64-0-Hourly2-GP3" if TERRAFORM_AWS_AMI_RHEL_7
default "RHEL-8.10.0_HVM-20250*" if TERRAFORM_AWS_AMI_RHEL_8
default "RHEL-8.10.0_HVM-2025*" if TERRAFORM_AWS_AMI_RHEL_8
default "RHEL-9.*" if TERRAFORM_AWS_AMI_RHEL_9

endif # TERRAFORM_AWS_DISTRO_REDHAT
Expand Down Expand Up @@ -392,8 +392,8 @@ config TERRAFORM_AWS_AMI_OWNER
config TERRAFORM_AWS_NS
string
output yaml
default "suse-sles-12-sp5-v20250*" if TERRAFORM_AWS_AMI_SUSE_LINUX_ENTERPRISE_12
default "suse-sles-15-sp*" if TERRAFORM_AWS_AMI_SUSE_LINUX_ENTERPRISE_15
default "suse-sles-12-sp5-v2025*" if TERRAFORM_AWS_AMI_SUSE_LINUX_ENTERPRISE_12
default "suse-sles-15-sp7-*" if TERRAFORM_AWS_AMI_SUSE_LINUX_ENTERPRISE_15
default "suse-sle-micro-5-*" if TERRAFORM_AWS_AMI_SUSE_LINUX_ENTERPRISE_5
default "suse-sle-micro-6-*" if TERRAFORM_AWS_AMI_SUSE_LINUX_ENTERPRISE_6

Expand Down Expand Up @@ -428,6 +428,9 @@ config TERRAFORM_AWS_AMI_UBUNTU_24_10
config TERRAFORM_AWS_AMI_UBUNTU_25_04
bool "Ubuntu 25.04"

config TERRAFORM_AWS_AMI_UBUNTU_25_10
bool "Ubuntu 25.10"

endchoice

config TERRAFORM_AWS_AMI_OWNER
Expand All @@ -445,5 +448,6 @@ config TERRAFORM_AWS_NS
default "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-a*" if TERRAFORM_AWS_AMI_UBUNTU_24_04_LTS
default "ubuntu/images/hvm-ssd-gp3/ubuntu-oracular-24.10-a*" if TERRAFORM_AWS_AMI_UBUNTU_24_10
default "ubuntu/images/hvm-ssd-gp3/ubuntu-plucky-25.04-a*" if TERRAFORM_AWS_AMI_UBUNTU_25_04
default "ubuntu/images/hvm-ssd-gp3/ubuntu-questing-25.10-a*" if TERRAFORM_AWS_AMI_UBUNTU_25_10

endif # TERRAFORM_AWS_DISTRO_CANONICAL
Loading
Loading