{"id":15156456,"url":"https://github.com/rancher/terraform-aws-server","last_synced_at":"2025-10-24T14:30:23.277Z","repository":{"id":188298084,"uuid":"660769379","full_name":"rancher/terraform-aws-server","owner":"rancher","description":"A Terraform Module Managing EC2 Instances","archived":false,"fork":false,"pushed_at":"2024-08-27T16:06:05.000Z","size":564,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":14,"default_branch":"main","last_synced_at":"2024-09-27T19:21:31.258Z","etag":null,"topics":["aws","aws-ec2","terraform","terraform-module"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rancher.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-30T19:54:06.000Z","updated_at":"2024-08-27T16:03:18.000Z","dependencies_parsed_at":"2023-09-26T18:26:47.300Z","dependency_job_id":"33a8c8a1-7efc-429a-9ba3-d3ac24772130","html_url":"https://github.com/rancher/terraform-aws-server","commit_stats":{"total_commits":122,"total_committers":4,"mean_commits":30.5,"dds":0.5573770491803278,"last_synced_commit":"bb10d20f7e62d19c528c82d27f502db2d097812e"},"previous_names":["rancher/terraform-aws-server"],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rancher%2Fterraform-aws-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rancher%2Fterraform-aws-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rancher%2Fterraform-aws-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rancher%2Fterraform-aws-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rancher","download_url":"https://codeload.github.com/rancher/terraform-aws-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219868598,"owners_count":16555871,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-ec2","terraform","terraform-module"],"created_at":"2024-09-26T19:21:42.926Z","updated_at":"2025-10-24T14:30:23.271Z","avatar_url":"https://github.com/rancher.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terraform AWS Server\n\nThis module deploys infrastructure in AWS.\n\nWARNING! We test in regions us-west-2, us-west-1, us-east-1, and us-east-2.\nOur selected image types may not exist in your region, in which case you can select an image manually.\nSee the examples/select/image for an example of how to do this\n\n## Recent Changes\n\n1. Image update and remove Terraform restrictions\n    As part of a wider goal to support OpenTofu I have removed the restrictions on the Terraform provider.\n    Added SLE-Micro 6.1 since it is now out and supported, and removed Rocky-8 since it is no longer actively supported.\n2. IPv6 Only Support\n    To support load balanced IPv6 only instances, the primary interface needs to have the 'primary ipv6 enabled' flag set.\n    This flag is not currently available in the Terraform provider, but a PR exists: https://github.com/hashicorp/terraform-provider-aws/pull/36425\n    Until the provider supports this flag we are using a workaround.\n    The workaround requires the AWS CLI to be installed on the server running Terraform.\n    The AWS CLI will use the same authentication mechanisms as Terraform, so there is no need to configure additional credentials.\n    WARNING! If deploying with `ip_family = \"ipv6\"` the server running Terraform must have the AWS CLI installed.\n3. Rename images\n    - Removed SUSE images that weren't BYOS (bring your own subscription)\n      - Amazon subscriptions are harder to automate and don't provide direct service, it ends up being a hidden fee of using the image. Instead, users can use the BYOS image without a subscription until they need one, and then they can add a subscription separately bought from SUSE.\n    - Started using SUSE cloud info API to get the latest image names\n\n## AWS Access\n\nThe first step to using the AWS modules is having an AWS account, [here](https://docs.aws.amazon.com/accounts/latest/reference/manage-acct-creating.html) is a document describing this process.\nYou will need an API access key id and API secret key, you can get the API keys [following this tutorial](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html#Using_CreateAccessKey).\nThe Terraform AWS provider uses the AWS Go SDK, which allows the use of either environment variables or [config files](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html#cli-configure-files-settings) for authentication.\n\nYou do not need the AWS cli to generate the files, just place them in the proper place and Terraform will find and read them.\n\n## Server Types\n\nThis module provides a pre-chosen set of \"types\" of servers in order to reduce choice fatigue for the user and streamline testing.\nThe choices are detailed [in the server module](./modules/server/types.tf) and below:\n\n```\n# storage sizes in GB, using gp3 storage type\nlocals {\n  types = {\n    small = { # minimum required for rke2 control plane node, handles 0-225 agents\n      id      = \"t3.medium\",\n      cpu     = \"2\",\n      ram     = \"4\",\n      storage = \"20\",\n    },\n    medium = { # agent node, fits requirements for a database server or a small gaming server\n      id      = \"m5.large\",\n      cpu     = \"2\",\n      ram     = \"8\",\n      storage = \"200\",\n    },\n    large = { # control plane handling 226-450 agents, also fits requirements for a git server\n      id      = \"c5.xlarge\",\n      cpu     = \"4\",\n      ram     = \"8\",\n      storage = \"500\",\n    },\n    xl = { # control plane handling 451-1300 agents, also fits requirements for a large database server, gaming server, or a distributed storage solution\n      id      = \"t3.xlarge\",\n      cpu     = \"4\",\n      ram     = \"16\",\n      storage = \"1000\",\n    }\n    xxl = { # control plane handling 1300+ agents, also fits requirements for a large gaming server, a large database server, or a distributed storage solution\n      id      = \"m5.2xlarge\",\n      cpu     = \"8\",\n      ram     = \"32\",\n      storage = \"2000\",\n    }\n  }\n}\n```\n\n### Image types\n\nThis module provides a pre-chosen set of \"types\" of images in order to reduce choice fatigue for the user and streamline testing.\nThe choices are detailed [in the image module](./modules/image/types.tf) and below:\n\n```\n# using the getImages script in this directory with argument \"sles\"\n# suse-sles-15-sp6-chost-byos-v20250212-hvm-ssd-x86_64\nsles-15 = { # BYOS = Bring Your Own Subscription\n  user         = \"ec2-user\",\n  group        = \"wheel\",\n  name         = \"suse-sles-15-sp6-chost-byos-v*-hvm-ssd-x86_64\",        #chost refers to an image that is optimized for running containers\n  name_regex   = \"^suse-sles-15-sp6-chost-byos-v[0-9]+-hvm-ssd-x86_64$\", # we are specifically trying to avoid the -ecs- images\n  product_code = \"\",\n  owners       = [\"013907871322\"],\n  architecture = \"x86_64\",\n  workfolder   = \"~\"\n},\n\n# using the getImages script in this directory with argument \"sle-micro\"\n# suse-sle-micro-5-5-byos-v20250131-hvm-ssd-x86_64\n# sle micro is already optimized for containers\nsle-micro-55 = { # BYOS = Bring Your Own Subscription\n  user         = \"ec2-user\",\n  group        = \"wheel\",\n  name         = \"suse-sle-micro-5-5-byos-v*-hvm-ssd-x86_64\",\n  name_regex   = \"^suse-sle-micro-5-5-byos-v[0-9]+-hvm-ssd-x86_64$\",\n  product_code = \"\",\n  owners       = [\"013907871322\"],\n  architecture = \"x86_64\",\n  workfolder   = \"~\"\n}\n\n# using the getImages script in this directory with argument \"sle-micro\"\n# suse-sle-micro-6-0-byos-v20250210-hvm-ssd-x86_64\n# sle micro is already optimized for containers\nsle-micro-60 = { # BYOS = Bring Your Own Subscription\n  user         = \"suse\",\n  group        = \"wheel\",\n  name         = \"suse-sle-micro-6-0-byos-v*-hvm-ssd-x86_64\",\n  name_regex   = \"^suse-sle-micro-6-0-byos-v[0-9]+-hvm-ssd-x86_64$\",\n  product_code = \"\",\n  owners       = [\"013907871322\"],\n  architecture = \"x86_64\",\n  workfolder   = \"~\"\n}\n\n# using the getImages script in this directory with argument \"sle-micro\"\n# suse-sle-micro-6-1-byos-v20250210-hvm-ssd-x86_64\n# sle micro is already optimized for containers\nsle-micro-61 = { # BYOS = Bring Your Own Subscription\n  user         = \"suse\",\n  group        = \"wheel\",\n  name         = \"suse-sle-micro-6-1-byos-v*-hvm-ssd-x86_64\",\n  name_regex   = \"^suse-sle-micro-6-1-byos-v[0-9]+-hvm-ssd-x86_64$\",\n  product_code = \"\",\n  owners       = [\"013907871322\"],\n  architecture = \"x86_64\",\n  workfolder   = \"~\"\n}\n\n# WARNING! you must subscribe and accept the terms to use this image\n# https://aws.amazon.com/marketplace/server/procurement?productId=ca1fe94d-9237-41c7-8fc8-78b6b0658c9f\n# example: CIS Red Hat Enterprise Linux 8 Benchmark - STIG - v12 -ca1fe94d-9237-41c7-8fc8-78b6b0658c9f\ncis-rhel-8 = {\n  user         = \"ec2-user\",\n  group        = \"wheel\",\n  name         = \"CIS Red Hat Enterprise Linux 8 Benchmark - STIG*\"\n  name_regex   = \".*\",\n  product_code = \"bysa8cc41lo4owixsmqw6v44f\",\n  owners       = [\"679593333241\"],\n  architecture = \"x86_64\",\n  workfolder   = \"/var/tmp\"\n},\n\n# WARNING! you must subscribe and accept the terms to use this image\n# ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-20250305\nubuntu-22 = {\n  user         = \"ubuntu\",\n  group        = \"admin\",\n  name         = \"ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*\",\n  name_regex   = \"^ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-[0-9]+$\", # specifically avoiding .1 images eg. ubuntu-jammy-22.04-amd64-server-20240207.1-47489723-7305-4e22-8b22-b0d57054f216\n  product_code = \"\",                                                               #\"47xbqns9xujfkkjt189a13aqe\",\n  owners       = [\"099720109477\"],\n  architecture = \"x86_64\",\n  workfolder   = \"~\"\n},\n\n# WARNING! you must subscribe and accept the terms to use this image\n# https://aws.amazon.com/marketplace/pp/prodview-a2hsmwr6uilqq\n# ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-20250305\nubuntu-24 = {\n  user         = \"ubuntu\",\n  group        = \"admin\",\n  name         = \"ubuntu-minimal/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-minimal-*\",\n  name_regex   = \"^ubuntu-minimal/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-minimal-[0-9]+$\",\n  product_code = \"\",\n  owners       = [\"099720109477\"],\n  architecture = \"x86_64\",\n  workfolder   = \"~\"\n},\n\n# WARNING! you must subscribe and accept the terms to use this image\n# https://aws.amazon.com/marketplace/pp/prodview-yjxmiuc6p5jzk\n# Rocky-9-EC2-LVM-9.5-20241118.0.x86_64-prod-hyj6jp3bki4bm\nrocky-9 = {\n  user         = \"ec2-user\",\n  group        = \"wheel\",\n  name         = \"Rocky-9-EC2-LVM-9.*-*.*.x86_64-prod-*\",\n  name_regex   = \"^Rocky-9-EC2-LVM-9.[0-9]+-[0-9]+.[0-9].x86_64-prod-[0-9a-z]+$\",\n  product_code = \"c0tjzp9xnxvr0ah4f0yletr6b\",\n  owners       = [\"679593333241\"],\n  architecture = \"x86_64\",\n  workfolder   = \"~\"\n},\n\n# the goal for these search strings is to keep them as stable as possible without specifying a version that is EOL\n# our users often rely on extended support from RHEL, so we don't consider odd numbered minors which are inelegible for that\n# https://access.redhat.com/support/policy/updates/errata\n# therefore the search found here is the most recent even minor that has been released\n# expect RHEL 9.4 in June 2024\n# RHEL-9.5.0_HVM-20241211-x86_64-0-Hourly2-GP3\nrhel-9 = {\n  user         = \"ec2-user\",\n  group        = \"wheel\",\n  name         = \"RHEL-9.*.*_HVM-*-x86_64-*-Hourly2-GP3\",\n  name_regex   = \"^RHEL-9.[0-9].[0-9]_HVM-[0-9]+-x86_64-[0-9]-Hourly2-GP3$\",\n  product_code = \"\",\n  owners       = [\"309956199498\"],\n  architecture = \"x86_64\",\n  workfolder   = \"~\"\n},\n\n# this is a community AMI with no product code or marketplace page, but it is produced by our cloud team\n# suse-liberty-linux-8-9-byos-v20240603-x86_64\nliberty-8 = {\n  user         = \"ec2-user\",\n  group        = \"wheel\",\n  name         = \"suse-liberty-linux-8-*-byos-v*-x86_64\",\n  name_regex   = \"^suse-liberty-linux-8-[0-9]-byos-v[0-9]+-x86_64$\",\n  product_code = \"\",\n  owners       = [\"013907871322\"],\n  architecture = \"x86_64\",\n  workfolder   = \"~\"\n},\n```\n\n## Examples\n\n### Local State\n\nThe specific use case for the example modules is temporary infrastructure for testing purposes.\nWith that in mind, it is not expected that we manage the resources as a team, therefore the state files are all stored locally.\nIf you would like to store the state files remotely, add a terraform backend file (`*.name.tfbackend`) to your root module.\nhttps://www.terraform.io/language/settings/backends/configuration#file\n\n## Development and Testing\n\n### Paradigms and Expectations\n\nPlease make sure to read [terraform.md](./terraform.md) to understand the paradigms and expectations that this module has for development.\n\n### Environment\n\nIt is important to us that all collaborators have the ability to develop in similar environments,\n so we use tools which enable this as much as possible.\nThese tools are not necessary, but they can make it much simpler to collaborate.\n\n* I use [nix](https://nixos.org/) that I have installed using [their recommended script](https://nixos.org/download.html#nix-install-macos)\n* I use [direnv](https://direnv.net/) that I have installed using brew.\n* I simply use `direnv allow` to enter the environment\n* I navigate to the `tests` directory and run `go test -v -timeout=40m -parallel=10`\n  * It is important to note that the test files do not stand alone, they expect to run as a package.\n  * This means that specifying the file to test (as follows) will fail: `go test -v -timeout 40m -parallel 10 basic_test.go`\n* To run an individual test I navigate to the `tests` directory and run `go test -v -timeout 40m -parallel 10 -run \u003ctest function name\u003e`\n  * eg. `go test -v -timeout 40m -parallel 10 -run TestBasic`\n\n\nOur continuous integration tests in the GitHub [ubuntu-latest runner](https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md). It is free for public repositories, we use Nix to add dependencies to it for building and testing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Francher%2Fterraform-aws-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Francher%2Fterraform-aws-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Francher%2Fterraform-aws-server/lists"}