Repository: hotosm/k8s-infra
Pull request #16: build: provision EKS cluster via OpenTofu
Author: login: aliziel
Created: 2025-05-20T22:06:08Z | Merged: 2025-05-29T19:23:53Z

## What type of PR is this? (check all applicable)

- [ ] 🍕 Feature
- [ ] 🐛 Bug Fix
- [x] 📝 Documentation
- [ ] 🧑‍💻 Refactor
- [ ] ✅ Test
- [x] 🤖 Build or CI
- [ ] ❓ Other (please specify)

## Related Issue

https://github.com/hotosm/k8s-infra/issues/14
https://github.com/hotosm/OpenAerialMap/issues/184

## Describe this PR

NOTE: Items like the Helm install scripts and docs should be further developed in https://github.com/hotosm/OpenAerialMap/issues/193 + https://github.com/hotosm/OpenAerialMap/issues/194

1. Defines cluster infrastructure for management via OpenTofu
    1. Control plane: EKS v1.32, Extended Support disabled
    1. Worker nodes: EKS Node Group (EC2 Amazon Linux + ASG)
    1. Networking: Dedicated VPC
    1. Ingress: Nginx
    1. Storage: EBS
    1. TF Backend: S3 + Dynamo ([S3-only locking expected next release](https://github.com/opentofu/opentofu/issues/599))
1. Defines basic deployment workflow via GitHub Actions
1. Provides basic scripts for deploying eoAPI chart
1. Adds [preferred license](https://docs.hotosm.org/dev-guide/repo-management/licensing/#licensing)
1. Moves proposal from README to new `/docs` directory, local dev guidance and TF overview docs are still TODO

## Alternative Approaches Considered

1. Terraform → OpenTofu
    1. Originally managed through Terraform, but concerns over licensing surfaced a preference for OpenTofu
        1. [Slack Tofu thread](https://developmentseed.slack.com/archives/C08B8L61QTT/p1744225530679089)
        1. [GitHub license thread](https://github.com/hotosm/OpenAerialMap/issues/184#issuecomment-2790860291)
    1. Switched to OpenTofu in 8d6f15dc250b3c27756372bb07d67ad9f48df6e9
1. Internal → External TF Modules
    1. Related to previous item, preference also surfaced for modules not maintained internally
        1. [Slack Tofu thread](https://developmentseed.slack.com/archives/C08B8L61QTT/p1744225530679089)
    1. Switched to AWS's VPC module in dd662d98ef4a630ffc222ce4d9e153e508b80313


## Review Guide

### Option 1: Inspect existing build

Link to currently deployed setup is in `#oam-dev` Slack channel

### Option 2: Manual build verification

1. Install required tooling if not already available on local machine
    1. [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
    1. [OpenTofu](https://opentofu.org/docs/intro/install/)
    1. [kubectl](https://kubernetes.io/docs/tasks/tools/) (to verify eoAPI deploy scripts)
    1. [Helm](https://helm.sh/docs/intro/install/) (to verify eoAPI deploy scripts)
1. Pull down this branch
1. Define variables for temporary build/destroy
    1. Only `region` is required, which can be entered via prompt during the below actions
        1. Make sure the AWS profile in context matches the provided region
    1. Defaults can be overridden ([docs](https://opentofu.org/docs/language/values/variables/#assigning-values-to-root-module-variables)), see the deploy workflow for an example using a variable file
        1. The below commands don't assume a certain variable setup. Sourcing override values will require additional commands or flags.
1. Recommend changing the `terraform.backend.s3.bucket` to a dev bucket with versioning enabled
    1. Currently set to main TF bucket, to align with other HOT IaC
    1. OpenTofu supports variable use in backend config, so this could be made 'dynamic' if preferred
1. ```sh
    $ cd terraform
    $ tofu init
    # Expect success output with confirmation: `OpenTofu has been successfully initialized!`
    ```
1. ```sh
    $ tofu validate
    # Expect: `Success! The configuration is valid.`
    ```
1. ```sh
    $ tofu plan
    # Expect success output with breakdown of resources to provision 
    # Expect ending with: `Plan: X to add, Y to change, Z to destroy.`
    ```
1. ```sh
    $ tofu apply -target="module.vpc"
    # Expect success output ending with: `Apply complete! Resources: X added, Y changed, Z destroyed.`
    ```
1. ```sh
    $ tofu apply
    # Expect success output ending with: `Apply complete! Resources: X added, Y changed, Z destroyed.`
    ```
1. ```sh
    $ cd -
    $ make kubeconfig
    # Expect: `Updated context arn:aws:eks:[...] in [local kubeconfig]`
    
    # Further cluster exploration can be done here before possibly installing eoAPI chart, ex:
    $ kubectl —help
    $ kubectl get pod,svc,deploy -A
    ```
1. ```sh
    $ make init-eoapi
    # Expect success output, including hippo ASCII art 🦛 
    
    $ helm repo list
    # Expect eoAPI listed
    ```
1. ```sh
    $ make deploy-eoapi
    # Expect success output, including block of eoAPI installation notes/guidance
    ```
1. ```sh
    # Cleanup
    $ helm uninstall eoapi
    # release "eoapi" uninstalled
    $ helm uninstall pgo
    # release "pgo" uninstalled
    $ cd terraform && tofu destroy
    # Destroy complete! Resources: X destroyed.
    ```



Diff:
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
new file mode 100644
index 00000000..6cf0209a
--- /dev/null
+++ b/.github/workflows/ci.yaml
@@ -0,0 +1,46 @@
+name: Deploy Terraform
+on:
+  push:
+    branches:
+      - main
+  pull_request:
+    branches:
+      - main
+
+permissions:
+  id-token: write
+  contents: read
+  actions: read
+  checks: write
+  pull-requests: write
+
+env:
+  AWS_REGION: ${{ vars.AWS_REGION || 'us-east-1' }}
+  VAR_FILE: ${{ vars.VAR_FILE || 'vars/production.tfvars' }}
+
+jobs:
+  deploy:
+    runs-on: ubuntu-24.04
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+      - name: Setup OpenTofu
+        uses: opentofu/setup-opentofu@v1
+        with:
+          tofu_wrapper: false
+      - name: Configure AWS credentials
+        uses: aws-actions/configure-aws-credentials@v4
+        with:
+          aws-region: ${{ env.AWS_REGION }}
+          role-to-assume: ${{ secrets.AWS_OIDC_ROLE }}
+      - name: Provision TF
+        uses: op5dev/tf-via-pr@v13
+        with:
+          command: ${{ github.event_name == 'push' && 'apply' || 'plan' }}
+          tool: tofu
+          working-directory: terraform
+          validate: true
+          format: true
+          arg-var-file: ${{ env.VAR_FILE }}
+          arg-var: cluster_ci_access_role_arn=${{ secrets.AWS_OIDC_ROLE }}
+          label-pr: false
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 7efa1c35..9152b0a0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,6 @@
-**/.terraform
-**/.tfvars
+# Local .terraform directories
+**/.terraform/*
+
+# .tfstate files
+*.tfstate
+*.tfstate.*
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000..5469257f
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,660 @@
+# GNU AFFERO GENERAL PUBLIC LICENSE
+
+Version 3, 19 November 2007
+
+Copyright (C) 2007 Free Software Foundation, Inc.
+<https://fsf.org/>
+
+Everyone is permitted to copy and distribute verbatim copies of this
+license document, but changing it is not allowed.
+
+## Preamble
+
+The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains
+free software for all its users.
+
+When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals. This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing
+under this license.
+
+The precise terms and conditions for copying, distribution and
+modification follow.
+
+## TERMS AND CONDITIONS
+
+### 0. Definitions.
+
+"This License" refers to version 3 of the GNU Affero General Public
+License.
+
+"Copyright" also means copyright-like laws that apply to other kinds
+of works, such as semiconductor masks.
+
+"The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of
+an exact copy. The resulting work is called a "modified version" of
+the earlier work or a work "based on" the earlier work.
+
+A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user
+through a computer network, with no transfer of a copy, is not
+conveying.
+
+An interactive user interface displays "Appropriate Legal Notices" to
+the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+### 1. Source Code.
+
+The "source code" for a work means the preferred form of the work for
+making modifications to it. "Object code" means any non-source form of
+a work.
+
+A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+The Corresponding Source need not include anything that users can
+regenerate automatically from other parts of the Corresponding Source.
+
+The Corresponding Source for a work in source code form is that same
+work.
+
+### 2. Basic Permissions.
+
+All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+You may make, run and propagate covered works that you do not convey,
+without conditions so long as your license otherwise remains in force.
+You may convey covered works to others for the sole purpose of having
+them make modifications exclusively for you, or provide you with
+facilities for running those works, provided that you comply with the
+terms of this License in conveying all material for which you do not
+control copyright. Those thus making or running the covered works for
+you must do so exclusively on your behalf, under your direction and
+control, on terms that prohibit them from making any copies of your
+copyrighted material outside their relationship with you.
+
+Conveying under any other circumstances is permitted solely under the
+conditions stated below. Sublicensing is not allowed; section 10 makes
+it unnecessary.
+
+### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such
+circumvention is effected by exercising rights under this License with
+respect to the covered work, and you disclaim any intention to limit
+operation or modification of the work as a means of enforcing, against
+the work's users, your or third parties' legal rights to forbid
+circumvention of technological measures.
+
+### 4. Conveying Verbatim Copies.
+
+You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+### 5. Conveying Modified Source Versions.
+
+You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these
+conditions:
+
+-   a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+-   b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under
+    section 7. This requirement modifies the requirement in section 4
+    to "keep intact all notices".
+-   c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy. This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged. This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+-   d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+### 6. Conveying Non-Source Forms.
+
+You may convey a covered work in object code form under the terms of
+sections 4 and 5, provided that you also convey the machine-readable
+Corresponding Source under the terms of this License, in one of these
+ways:
+
+-   a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+-   b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the Corresponding
+    Source from a network server at no charge.
+-   c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source. This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+-   d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge. You need not require recipients to copy the
+    Corresponding Source along with the object code. If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source. Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+-   e) Convey the object code using peer-to-peer transmission,
+    provided you inform other peers where the object code and
+    Corresponding Source of the work are being offered to the general
+    public at no charge under subsection 6d.
+
+A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal,
+family, or household purposes, or (2) anything designed or sold for
+incorporation into a dwelling. In determining whether a product is a
+consumer product, doubtful cases shall be resolved in favor of
+coverage. For a particular product received by a particular user,
+"normally used" refers to a typical or common use of that class of
+product, regardless of the status of the particular user or of the way
+in which the particular user actually uses, or expects or is expected
+to use, the product. A product is a consumer product regardless of
+whether the product has substantial commercial, industrial or
+non-consumer uses, unless such uses represent the only significant
+mode of use of the product.
+
+"Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to
+install and execute modified versions of a covered work in that User
+Product from a modified version of its Corresponding Source. The
+information must suffice to ensure that the continued functioning of
+the modified object code is in no case prevented or interfered with
+solely because modification has been made.
+
+If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or
+updates for a work that has been modified or installed by the
+recipient, or for the User Product in which it has been modified or
+installed. Access to a network may be denied when the modification
+itself materially and adversely affects the operation of the network
+or violates the rules and protocols for communication across the
+network.
+
+Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+### 7. Additional Terms.
+
+"Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders
+of that material) supplement the terms of this License with terms:
+
+-   a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+-   b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+-   c) Prohibiting misrepresentation of the origin of that material,
+    or requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+-   d) Limiting the use for publicity purposes of names of licensors
+    or authors of the material; or
+-   e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+-   f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions
+    of it) with contractual assumptions of liability to the recipient,
+    for any liability that these contractual assumptions directly
+    impose on those licensors and authors.
+
+All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions; the
+above requirements apply either way.
+
+### 8. Termination.
+
+You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+However, if you cease all violation of this License, then your license
+from a particular copyright holder is reinstated (a) provisionally,
+unless and until the copyright holder explicitly and finally
+terminates your license, and (b) permanently, if the copyright holder
+fails to notify you of the violation by some reasonable means prior to
+60 days after the cessation.
+
+Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+### 9. Acceptance Not Required for Having Copies.
+
+You are not required to accept this License in order to receive or run
+a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+### 10. Automatic Licensing of Downstream Recipients.
+
+Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+### 11. Patents.
+
+A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+A contributor's "essential patent claims" are all patent claims owned
+or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+A patent license is "discriminatory" if it does not include within the
+scope of its coverage, prohibits the exercise of, or is conditioned on
+the non-exercise of one or more of the rights that are specifically
+granted under this License. You may not convey a covered work if you
+are a party to an arrangement with a third party that is in the
+business of distributing software, under which you make payment to the
+third party based on the extent of your activity of conveying the
+work, and under which the third party grants, to any of the parties
+who would receive the covered work from you, a discriminatory patent
+license (a) in connection with copies of the covered work conveyed by
+you (or copies made from those copies), or (b) primarily for and in
+connection with specific products or compilations that contain the
+covered work, unless you entered into that arrangement, or that patent
+license was granted, prior to 28 March 2007.
+
+Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+### 12. No Surrender of Others' Freedom.
+
+If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under
+this License and any other pertinent obligations, then as a
+consequence you may not convey it at all. For example, if you agree to
+terms that obligate you to collect a royalty for further conveying
+from those to whom you convey the Program, the only way you could
+satisfy both those terms and this License would be to refrain entirely
+from conveying the Program.
+
+### 13. Remote Network Interaction; Use with the GNU General Public License.
+
+Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your
+version supports such interaction) an opportunity to receive the
+Corresponding Source of your version by providing access to the
+Corresponding Source from a network server at no charge, through some
+standard or customary means of facilitating copying of software. This
+Corresponding Source shall include the Corresponding Source for any
+work covered by version 3 of the GNU General Public License that is
+incorporated pursuant to the following paragraph.
+
+Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+### 14. Revised Versions of this License.
+
+The Free Software Foundation may publish revised and/or new versions
+of the GNU Affero General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever
+published by the Free Software Foundation.
+
+If the Program specifies that a proxy can decide which future versions
+of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+### 15. Disclaimer of Warranty.
+
+THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
+WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
+DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
+CORRECTION.
+
+### 16. Limitation of Liability.
+
+IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
+CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
+ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
+NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
+LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
+TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
+PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+### 17. Interpretation of Sections 15 and 16.
+
+If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+END OF TERMS AND CONDITIONS
+
+## How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these
+terms.
+
+To do so, attach the following notices to the program. It is safest to
+attach them to the start of each source file to most effectively state
+the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+        <one line to give the program's name and a brief idea of what it does.>
+        Copyright (C) <year>  <name of author>
+
+        This program is free software: you can redistribute it and/or modify
+        it under the terms of the GNU Affero General Public License as
+        published by the Free Software Foundation, either version 3 of the
+        License, or (at your option) any later version.
+
+        This program is distributed in the hope that it will be useful,
+        but WITHOUT ANY WARRANTY; without even the implied warranty of
+        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+        GNU Affero General Public License for more details.
+
+        You should have received a copy of the GNU Affero General Public License
+        along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper
+mail.
+
+If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source. For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code. There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for
+the specific requirements.
+
+You should also get your employer (if you work as a programmer) or
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. For more information on this, and how to apply and follow
+the GNU AGPL, see <https://www.gnu.org/licenses/>.
\ No newline at end of file
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..b75256cb
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,37 @@
+AWS_PROFILE ?= default
+CLUSTER_NAME = $(shell tofu -chdir=terraform output cluster_name)
+S3_BACKUP_ROLE = $(shell tofu -chdir=terraform output s3_backup_role)
+
+PGO_CHART_VERSION = 5.7.4
+EOAPI_CHART_VERSION = 0.7.1
+
+.DEFAULT_GOAL := help
+
+$(VERBOSE).SILENT:
+
+.PHONY: help
+
+help: Makefile
+	@echo
+	@echo "Usage: make [target]"
+	@echo
+	@echo "Targets:"
+	@sed -n 's/^##//p' $< | column -t -s ':'
+	@echo
+
+## kubeconfig: Configure kubectl to connect to EKS cluster
+kubeconfig:
+	aws eks update-kubeconfig --name $(CLUSTER_NAME)
+
+## init-eoapi: Add eoAPI repo and install dependencies
+init-eoapi:
+	command -v helm >/dev/null 2>&1 || { echo "Helm is required but not installed"; exit 1; }
+	echo "Installing PostgresQL operator chart (eoAPI dependency)"
+	helm upgrade --install --set disable_check_for_upgrades=true pgo oci://registry.developers.crunchydata.com/crunchydata/pgo --version $(PGO_CHART_VERSION)
+	echo "Adding eoAPI repository."
+	helm repo add eoapi https://devseed.com/eoapi-k8s/
+
+## deploy-eoapi: Upgrade or install eoAPI release
+deploy-eoapi:
+	helm repo list | grep "eoapi" >/dev/null 2>&1 || { echo "Not initialized, run 'make init-eoapi' before retrying"; exit 1; }
+	helm upgrade --install --namespace eoapi --create-namespace eoapi eoapi/eoapi --version $(EOAPI_CHART_VERSION) -f kubernetes/helm/eoapi.yaml --set previousVersion=$(EOAPI_CHART_VERSION) --set postgrescluster.metadata.annotations.eks.amazonaws.com/role-arn=$(S3_BACKUP_ROLE)
\ No newline at end of file
diff --git a/README.md b/README.md
index 2b6dcdd8..f385592d 100644
--- a/README.md
+++ b/README.md
@@ -1,89 +1,19 @@
 # HOT’s Infrastructure Modernization: Kubernetes
 
-## Requirement
+> [!Note]
+> Currently under initial development. 
 
-- HOT is quite reliant on vendor-specific cloud services for various tools.
-- We rely heavily on donated credits from cloud providers (today, we fully rely on AWS) and have minimal internal funding for infrastructure. This source comes with few guarantees! 
-- Ideally we would have a cloud-agnostic approach to deployment, giving the flexibility to deploy anywhere if the case arises (AWS, Azure, Hetzner, on-prem).
-- This is not a small task, and also won’t solve all of our problems, but it would be a great start to migrate as many services as possible to cloud-agnostic approaches, via open tools such as Kubernetes, KEDA (scaling), ArgoCD (GitOps), etc.
+Kubernetes @ Humanitarian OpenStreetMap Team (HOT).
 
-## Challenges
+See the [inital proposal](docs/proposal.md) for more background.
 
-- Lack of time and resources to dedicate to this as a project - it’s difficult to justify addressing tech debt, when there is the allure of new features and updating software.
-- Lack of expertise in the tech team 
-  - Tech lead has previous k8s experience, but little time. 
-  - Some devs at our partner NAXA have also dabbled with k8s.
-- Heavy reliance of some tools on vendor-specific services.
+## Getting Started
 
-In order of most difficult → least difficult for migration in our 2024 assessment:
-  - OpenAerialMap (many AWS services / lambda etc).
-  - fAIr (GPU reliant ML workflows, task scheduling, autoscaling).
-  - Tasking Manager (autoscaling requirement, large user base).
-  - Export tool / raw-data-api (task scheduling, redis queue based autoscaling)
-  - FMTM & DroneTM
+#### Required Tools
 
-## Benefits
+[AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
+[OpenTofu](https://opentofu.org/docs/intro/install/)
+[kubectl](https://kubernetes.io/docs/tasks/tools/)
+[Helm](https://helm.sh/docs/intro/install/)
 
-- We would like to slowly start to become more cloud-agnostic in our deployment approach, making us more resilient to changes in the future.
-- Reduced costs 🤞, with resource utilization spread across a smaller cluster of VMs, instead of many under-utilized standalone VMs, but still able to handle load spikes.
-
-## Proposal
-
-- The core of this requirement is to configure a Kubernetes cluster, and start to migrate services into it.
-- This will involve two steps:
-  - Setup of the Kubernetes control plane. Likely EKS, but also open to managing this ourselves with an OS like Talos.
-  - Slow migration of services into the cluster, packaging them tools up as Helm charts, and deploying with all additional required components (autoscaling, job queue, etc).
-
-### Step 1: Control Plane & OSM Sandbox
-
-#### OSM Sandbox (Preamble)
-
-- A while ago we made https://github.com/hotosm/osm-sandbox, in an effort to have a ‘sandboxed’ OSM backend that could be attached to other services like TM (for private data, demo projects, various use cases).
-- Since then, we have decided to collaborate further with the developmentseed and osmus effort to create a deployment API for temporary osmseed instances.
-- This osm-sandbox-dashboard API allows for osmseed instances to be provisioned on demand, by calling an API, and starting the services within a linked Kubernetes cluster.
-
-#### Control Plane Setup
-
-- We can either use EKS, or a custom control plane based on EC2 instances.
-- Storage and networking must be configured.
-- We can set up Gateway API or Ingress, plus certificate management of some sort.
-- We need at least one attached worker node to deploy services onto.
-
-#### End Goals
-
-- A working Kubernetes cluster that we can deploy services into.
-- A configured Helm chart (already exists) for the osm-sandbox-dashboard.
-- Accessible via a URL - perhaps we have a DNS zone specifically for this, plus CNAME aliases to specific services.
-- Also nice to have: ArgoCD with the config for osm-sandbox-dashboard pulled from a repo, plus an easy visualisation dashboard of running services in the cluster.
-
-### Step 2: Deployment of Easier HOTOSM Apps
-
-These apps have fewer moving parts, or are easier to package up and deploy (FMTM has a partial helm chart already).
-
-- FMTM
-- DroneTM
-- Export Tool / Raw-Data-API
-(in order)
-
-#### FMTM
-
-- Some of the requirements for FMTM are already captured in issues here: https://github.com/hotosm/fmtm/issues?q=is%3Aissue%20state%3Aopen%20label%3Adevops
-- FMTM requires a deployment of ODK alongside it, meaning we also need to make a helm chart for that (it would be great to contribute to the community, but first we should discuss with the ODK team).
-
-#### DroneTM
-
-- The deployment of DroneTM will be quite similar to FMTM, but instead of a requirement for ODK, we also need to deploy OpenDroneMap, with NodeODM being scalable via CPU utilisation or queue length with a tool like KEDA.
-
-#### Export Tool / Raw-Data-API
-
-- Includes a Celery task queue.
-- More notes to come.
-
-### Step 3: Deployment of More Difficult HOTOSM Apps
-
-These apps have many moving parts that must be replaced from their AWS specific service to a more vendor-neutral alternative.
-
-- Tasking Manager
-- fAIr
-- OpenAerialMap
-(in order)
+// TODO 🚧
\ No newline at end of file
diff --git a/docs/proposal.md b/docs/proposal.md
new file mode 100644
index 00000000..2b6dcdd8
--- /dev/null
+++ b/docs/proposal.md
@@ -0,0 +1,89 @@
+# HOT’s Infrastructure Modernization: Kubernetes
+
+## Requirement
+
+- HOT is quite reliant on vendor-specific cloud services for various tools.
+- We rely heavily on donated credits from cloud providers (today, we fully rely on AWS) and have minimal internal funding for infrastructure. This source comes with few guarantees! 
+- Ideally we would have a cloud-agnostic approach to deployment, giving the flexibility to deploy anywhere if the case arises (AWS, Azure, Hetzner, on-prem).
+- This is not a small task, and also won’t solve all of our problems, but it would be a great start to migrate as many services as possible to cloud-agnostic approaches, via open tools such as Kubernetes, KEDA (scaling), ArgoCD (GitOps), etc.
+
+## Challenges
+
+- Lack of time and resources to dedicate to this as a project - it’s difficult to justify addressing tech debt, when there is the allure of new features and updating software.
+- Lack of expertise in the tech team 
+  - Tech lead has previous k8s experience, but little time. 
+  - Some devs at our partner NAXA have also dabbled with k8s.
+- Heavy reliance of some tools on vendor-specific services.
+
+In order of most difficult → least difficult for migration in our 2024 assessment:
+  - OpenAerialMap (many AWS services / lambda etc).
+  - fAIr (GPU reliant ML workflows, task scheduling, autoscaling).
+  - Tasking Manager (autoscaling requirement, large user base).
+  - Export tool / raw-data-api (task scheduling, redis queue based autoscaling)
+  - FMTM & DroneTM
+
+## Benefits
+
+- We would like to slowly start to become more cloud-agnostic in our deployment approach, making us more resilient to changes in the future.
+- Reduced costs 🤞, with resource utilization spread across a smaller cluster of VMs, instead of many under-utilized standalone VMs, but still able to handle load spikes.
+
+## Proposal
+
+- The core of this requirement is to configure a Kubernetes cluster, and start to migrate services into it.
+- This will involve two steps:
+  - Setup of the Kubernetes control plane. Likely EKS, but also open to managing this ourselves with an OS like Talos.
+  - Slow migration of services into the cluster, packaging them tools up as Helm charts, and deploying with all additional required components (autoscaling, job queue, etc).
+
+### Step 1: Control Plane & OSM Sandbox
+
+#### OSM Sandbox (Preamble)
+
+- A while ago we made https://github.com/hotosm/osm-sandbox, in an effort to have a ‘sandboxed’ OSM backend that could be attached to other services like TM (for private data, demo projects, various use cases).
+- Since then, we have decided to collaborate further with the developmentseed and osmus effort to create a deployment API for temporary osmseed instances.
+- This osm-sandbox-dashboard API allows for osmseed instances to be provisioned on demand, by calling an API, and starting the services within a linked Kubernetes cluster.
+
+#### Control Plane Setup
+
+- We can either use EKS, or a custom control plane based on EC2 instances.
+- Storage and networking must be configured.
+- We can set up Gateway API or Ingress, plus certificate management of some sort.
+- We need at least one attached worker node to deploy services onto.
+
+#### End Goals
+
+- A working Kubernetes cluster that we can deploy services into.
+- A configured Helm chart (already exists) for the osm-sandbox-dashboard.
+- Accessible via a URL - perhaps we have a DNS zone specifically for this, plus CNAME aliases to specific services.
+- Also nice to have: ArgoCD with the config for osm-sandbox-dashboard pulled from a repo, plus an easy visualisation dashboard of running services in the cluster.
+
+### Step 2: Deployment of Easier HOTOSM Apps
+
+These apps have fewer moving parts, or are easier to package up and deploy (FMTM has a partial helm chart already).
+
+- FMTM
+- DroneTM
+- Export Tool / Raw-Data-API
+(in order)
+
+#### FMTM
+
+- Some of the requirements for FMTM are already captured in issues here: https://github.com/hotosm/fmtm/issues?q=is%3Aissue%20state%3Aopen%20label%3Adevops
+- FMTM requires a deployment of ODK alongside it, meaning we also need to make a helm chart for that (it would be great to contribute to the community, but first we should discuss with the ODK team).
+
+#### DroneTM
+
+- The deployment of DroneTM will be quite similar to FMTM, but instead of a requirement for ODK, we also need to deploy OpenDroneMap, with NodeODM being scalable via CPU utilisation or queue length with a tool like KEDA.
+
+#### Export Tool / Raw-Data-API
+
+- Includes a Celery task queue.
+- More notes to come.
+
+### Step 3: Deployment of More Difficult HOTOSM Apps
+
+These apps have many moving parts that must be replaced from their AWS specific service to a more vendor-neutral alternative.
+
+- Tasking Manager
+- fAIr
+- OpenAerialMap
+(in order)
diff --git a/kubernetes/helm/eoapi.yaml b/kubernetes/helm/eoapi.yaml
new file mode 100644
index 00000000..784c4827
--- /dev/null
+++ b/kubernetes/helm/eoapi.yaml
@@ -0,0 +1,37 @@
+ingress:
+  annotations:
+    # increase the max body size to 100MB
+    nginx.ingress.kubernetes.io/proxy-body-size: "100m"
+    nginx.ingress.kubernetes.io/enable-cors: "true"
+    nginx.ingress.kubernetes.io/enable-access-log: "true"
+
+
+postgrescluster:
+  # # TODO: bridge alternatives for TF output to CRD annotations
+  # metadata:
+  #   annotations:
+  #     eks.amazonaws.com/role-arn: ""
+  backupsEnabled: true
+  s3:
+    bucket: "pgstac-backup"
+    endpoint: "s3.us-east-1.amazonaws.com"
+    region: "us-east-1"
+    keyType: "web-id"
+  instances:
+  - name: eoapi
+    replicas: 1
+    dataVolumeClaimSpec:
+      # TODO: gp3 SC
+      storageClassName: "gp2"
+      accessModes:
+      - "ReadWriteOnce"
+      resources:
+        requests:
+          storage: "10Gi"
+          cpu: "1024m"
+          memory: "3048Mi"
+
+pgstacBootstrap:
+  image:
+    name: ghcr.io/stac-utils/pgstac-pypgstac
+    tag: v0.9.6
diff --git a/terraform/.terraform.lock.hcl b/terraform/.terraform.lock.hcl
new file mode 100644
index 00000000..b11bf456
--- /dev/null
+++ b/terraform/.terraform.lock.hcl
@@ -0,0 +1,55 @@
+# This file is maintained automatically by "tofu init".
+# Manual edits may be lost in future updates.
+
+provider "registry.opentofu.org/hashicorp/aws" {
+  version     = "5.98.0"
+  constraints = "~> 5.8"
+  hashes = [
+    "h1:l0YRNODVmQ0KrZRiD9oOjAI+6cZCG2AQE5J9Qvf6u7I=",
+    "zh:1c8e4073151bc3f4e201a89ea5934733b7fe8a88399cf476bb53417e52e5a2d6",
+    "zh:433b575d313742cfffc808907cfdabf6f16ad4b2b4b722b33624c2c45ab28003",
+    "zh:4f10af33ac39df606a4ff2c685940349745b00f88f72717c6a35bf3aad8400a2",
+    "zh:63d442570d5fc8bef9139ef6e242b903b728282a4949721cfe6071ed5c05532a",
+    "zh:722e840d59c1126d2ed85cba09ff3d2d3597d6c3fa3d9a6f7d01c6d78772882e",
+    "zh:8270018389d9d095c20fe270b89e9be2ec444a5b447e1153436ff018b9e84710",
+    "zh:8cebf189600873a041c829cabb92096a5f8c9cd8ebec6997abcfb1a4981209a4",
+    "zh:a878695fc563f758fb29399ed10a44a3e96563062917fa8534766cd76f1b490e",
+    "zh:b9ea7fb2418462586642d1831775ea1872c3eda4180391459918de2f734d98c2",
+    "zh:ecc4ea0f659dab585e8328698d0bb343b80721e093b95af13769a4616c082fab",
+  ]
+}
+
+provider "registry.opentofu.org/hashicorp/helm" {
+  version     = "2.17.0"
+  constraints = "~> 2.17.0"
+  hashes = [
+    "h1:ShIag7wqd5Rs+zYpVMpjAh+T0ozr4XGYfSTKWqceQBY=",
+    "zh:02690815e35131a42cb9851f63a3369c216af30ad093d05b39001d43da04b56b",
+    "zh:27a62f12b29926387f4d71aeeee9f7ffa0ccb81a1b6066ee895716ad050d1b7a",
+    "zh:2d0a5babfa73604b3fefc9dab9c87f91c77fce756c2e32b294e9f1290aed26c0",
+    "zh:3976400ceba6dda4636e1d297e3097e1831de5628afa534a166de98a70d1dcbe",
+    "zh:54440ef14f342b41d75c1aded7487bfcc3f76322b75894235b47b7e89ac4bfa4",
+    "zh:6512e2ab9f2fa31cbb90d9249647b5c5798f62eb1215ec44da2cdaa24e38ad25",
+    "zh:795f327ca0b8c5368af0ed03d5d4f6da7260692b4b3ca0bd004ed542e683464d",
+    "zh:ba659e1d94f224bc3f1fd34cbb9d2663e3a8e734108e5a58eb49eda84b140978",
+    "zh:c5c8575c4458835c2acbc3d1ed5570589b14baa2525d8fbd04295c097caf41eb",
+    "zh:e0877a5dac3de138e61eefa26b2f5a13305a17259779465899880f70e11314e0",
+  ]
+}
+
+provider "registry.opentofu.org/hashicorp/tls" {
+  version = "4.1.0"
+  hashes = [
+    "h1:yNZuPWUgw6Ik2huf9lhsuCGONWo2rsY1MfeceT0BQpw=",
+    "zh:187a99f0d236fd92da224e2f026c4ca8f1dcbf2b5cddc8e6896801bacfab0d73",
+    "zh:61a32a01cc46f382014dcf7aff5bcac61fe97bd69d3ccb51c801e9437ecdb9ce",
+    "zh:683ba18baa2cc336ff83f061b5e4569e2cd7c4a097b53a2d80bb0a26be2fc59a",
+    "zh:85c7640ea13dcf5ae5f7f3abbf2f21e4b93ce7f333ffee5b4a6acd6b5fe71223",
+    "zh:882f2c5214fd6d280a500acfd560925a71030ef70e10d11fa2b94815b58ae9b6",
+    "zh:97cb5e0b81b8687870a6b8a16e9a9cfe546e2fdb7534bdd8302eda0d66393f78",
+    "zh:c0a0110b15ce45140036fe5bf5a44cb822c2f55b30ff2770faf37d7c3cae3b5e",
+    "zh:d98c1c63fd0c76704fd7be38c316c305a2c95f3215330f2fb1e6b0b7081bf8e9",
+    "zh:e703a7adf220ac436f8ebfd06529de865b965fcfc461c7ef7b71afa0de04c8e9",
+    "zh:e93e241150cd438a0708679cb4aa7976742fde02f4c1725cfdefc405c4eeca1a",
+  ]
+}
diff --git a/terraform/README.md b/terraform/README.md
new file mode 100644
index 00000000..01b5f5bf
--- /dev/null
+++ b/terraform/README.md
@@ -0,0 +1,3 @@
+// TODO 🚧
+
+https://github.com/developmentseed/eoapi-k8s-terraform
\ No newline at end of file
diff --git a/terraform/addons.tf b/terraform/addons.tf
new file mode 100644
index 00000000..ee94b3c2
--- /dev/null
+++ b/terraform/addons.tf
@@ -0,0 +1,37 @@
+# Allow roles to assume permissions with their OIDC credentials for use with IRSA
+data "aws_iam_policy_document" "assume_role_with_oidc" {
+  statement {
+    effect = "Allow"
+
+    principals {
+      type        = "Federated"
+      identifiers = [aws_iam_openid_connect_provider.cluster_oidc.arn]
+    }
+
+    actions = ["sts:AssumeRoleWithWebIdentity"]
+  }
+}
+
+# Setup the EBS CSI Driver addon - https://docs.aws.amazon.com/eks/latest/userguide/ebs-csi.html
+# Required for EBS volumes to be provisioned and attached
+resource "aws_iam_role" "ebs_provisioner" {
+  name                 = "${local.cluster_prefix}-eks-ebs-provisioner"
+  assume_role_policy   = data.aws_iam_policy_document.assume_role_with_oidc.json
+  permissions_boundary = var.permissions_boundary
+}
+
+resource "aws_iam_role_policy_attachment" "ebs_provisioner" {
+  policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy"
+  role       = aws_iam_role.ebs_provisioner.name
+}
+
+resource "aws_eks_addon" "ebs_provisioner" {
+  cluster_name                = aws_eks_cluster.cluster.name
+  addon_name                  = "aws-ebs-csi-driver"
+  addon_version               = var.ebs_driver_version
+  resolve_conflicts_on_create = "OVERWRITE"
+  service_account_role_arn    = aws_iam_role.ebs_provisioner.arn
+  depends_on = [
+    aws_iam_role_policy_attachment.ebs_provisioner
+  ]
+}
diff --git a/terraform/cluster.tf b/terraform/cluster.tf
new file mode 100644
index 00000000..bf596729
--- /dev/null
+++ b/terraform/cluster.tf
@@ -0,0 +1,131 @@
+resource "aws_eks_cluster" "cluster" {
+  name     = "${local.cluster_prefix}-cluster"
+  role_arn = aws_iam_role.cluster_control_plane.arn
+  version  = var.kubernetes_version
+
+  access_config {
+    authentication_mode = "API_AND_CONFIG_MAP"
+  }
+  vpc_config {
+    subnet_ids = concat(module.vpc.private_subnets, module.vpc.public_subnets)
+  }
+
+  upgrade_policy {
+    support_type = "STANDARD"
+  }
+
+  # Ensure that IAM Role permissions are created before and deleted after EKS Cluster handling.
+  # Otherwise, EKS will not be able to properly delete EKS managed EC2 infrastructure such as Security Groups.
+  depends_on = [
+    aws_iam_role_policy_attachment.cluster_control_plane
+  ]
+}
+
+data "aws_iam_policy_document" "assume_role" {
+  statement {
+    effect = "Allow"
+
+    principals {
+      type        = "Service"
+      identifiers = ["eks.amazonaws.com"]
+    }
+
+    actions = ["sts:AssumeRole"]
+  }
+}
+
+resource "aws_iam_role" "cluster_control_plane" {
+  name                 = "${local.cluster_prefix}-cluster-control-plane"
+  assume_role_policy   = data.aws_iam_policy_document.assume_role.json
+  permissions_boundary = var.permissions_boundary
+}
+
+resource "aws_iam_role_policy_attachment" "cluster_control_plane" {
+  policy_arn = "arn:aws:iam::aws:policy/AmazonEKSClusterPolicy"
+  role       = aws_iam_role.cluster_control_plane.name
+}
+
+# Parse the OIDC issuer TLS certificate so we can setup IRSA correctly
+data "tls_certificate" "cluster_oidc_certificate" {
+  url = aws_eks_cluster.cluster.identity[0].oidc[0].issuer
+}
+
+resource "aws_iam_openid_connect_provider" "cluster_oidc" {
+  client_id_list  = ["sts.amazonaws.com"]
+  thumbprint_list = data.tls_certificate.cluster_oidc_certificate.certificates[*].sha1_fingerprint
+  url             = data.tls_certificate.cluster_oidc_certificate.url
+}
+
+# https://github.com/kubernetes/autoscaler/blob/87a67e3aa0c831695f60408605d71f8e6ecdf90a/cluster-autoscaler/cloudprovider/aws/README.md?plain=1#L20
+data "aws_iam_policy_document" "cluster_autoscaler" {
+  statement {
+    effect = "Allow"
+
+    actions = [
+      "autoscaling:DescribeTags",
+      "autoscaling:DescribeAutoScalingGroups",
+      "autoscaling:DescribeAutoScalingInstances",
+      "autoscaling:DescribeLaunchConfigurations",
+      "autoscaling:DescribeScalingActivities",
+      "ec2:DescribeImages",
+      "ec2:DescribeInstanceTypes",
+      "ec2:DescribeLaunchTemplateVersions",
+      "ec2:GetInstanceTypesFromInstanceRequirements",
+      "eks:DescribeNodegroup"
+    ]
+
+    resources = ["*"]
+  }
+  statement {
+    effect = "Allow"
+
+    actions = [
+      "autoscaling:SetDesiredCapacity",
+      "autoscaling:TerminateInstanceInAutoScalingGroup"
+    ]
+
+    resources = ["*"]
+
+    condition {
+      test     = "StringEquals"
+      variable = "autoscaling:ResourceTag/kubernetes.io/cluster/${aws_eks_cluster.cluster.id}"
+      values   = ["owned"]
+    }
+  }
+}
+
+resource "aws_iam_role" "cluster_autoscaler" {
+  name                 = "${local.cluster_prefix}-cluster-autoscaler"
+  assume_role_policy   = data.aws_iam_policy_document.assume_role_with_oidc.json
+  permissions_boundary = var.permissions_boundary
+}
+
+resource "aws_iam_policy" "cluster_autoscaler" {
+  name   = "${local.cluster_prefix}-ClusterAutoscalerPolicy"
+  policy = data.aws_iam_policy_document.cluster_autoscaler.json
+}
+
+resource "aws_iam_role_policy_attachment" "cluster_autoscaler" {
+  role       = aws_iam_role.cluster_autoscaler.name
+  policy_arn = aws_iam_policy.cluster_autoscaler.arn
+}
+
+resource "aws_eks_access_entry" "admin_access" {
+  count = length(local.cluster_admins)
+
+  cluster_name      = aws_eks_cluster.cluster.name
+  principal_arn     = local.cluster_admins[count.index]
+  kubernetes_groups = ["cluster-admin"]
+}
+
+resource "aws_eks_access_policy_association" "admin_policy" {
+  count = length(local.cluster_admins)
+
+  cluster_name  = aws_eks_cluster.cluster.name
+  policy_arn    = "arn:aws:eks::aws:cluster-access-policy/AmazonEKSClusterAdminPolicy"
+  principal_arn = local.cluster_admins[count.index]
+
+  access_scope {
+    type = "cluster"
+  }
+}
diff --git a/terraform/helm-repos.tf b/terraform/helm-repos.tf
new file mode 100644
index 00000000..db8f8dd9
--- /dev/null
+++ b/terraform/helm-repos.tf
@@ -0,0 +1,175 @@
+provider "helm" {
+  kubernetes {
+    host                   = aws_eks_cluster.cluster.endpoint
+    cluster_ca_certificate = base64decode(aws_eks_cluster.cluster.certificate_authority[0].data)
+
+    exec {
+      api_version = "client.authentication.k8s.io/v1beta1"
+      command     = "aws"
+      args        = ["eks", "get-token", "--cluster-name", aws_eks_cluster.cluster.name]
+    }
+  }
+}
+
+resource "helm_release" "autoscaler" {
+  name             = "cluster-autoscaler"
+  repository       = "https://kubernetes.github.io/autoscaler"
+  chart            = "cluster-autoscaler"
+  version          = var.cluster_autoscaler_version
+  namespace        = "cluster-autoscaler"
+  create_namespace = true
+
+  set {
+    name  = "autoDiscovery.clusterName"
+    value = aws_eks_cluster.cluster.name
+  }
+
+  set {
+    name  = "awsRegion"
+    value = var.region
+  }
+
+  set {
+    # Double escaping needed as otherwise . is inteprerted as nesting
+    name  = "rbac.serviceAccount.annotations.eks\\.amazonaws\\.com/role-arn"
+    value = aws_iam_role.cluster_autoscaler.arn
+  }
+
+  wait = true
+
+  depends_on = [
+    aws_eks_cluster.cluster
+  ]
+}
+
+resource "helm_release" "ingress" {
+  name             = "ingress"
+  repository       = "https://kubernetes.github.io/ingress-nginx"
+  chart            = "ingress-nginx"
+  namespace        = "ingress-nginx"
+  create_namespace = true
+  version          = var.nginx_ingress_version
+
+  set {
+    name  = "controller.enableLatencyMetrics"
+    value = true
+  }
+
+  set {
+    name  = "controller.metrics.enabled"
+    value = true
+  }
+
+  set {
+    name  = "controller.metrics.service.annotations.prometheus\\.io/scrape"
+    value = "true"
+    type  = "string"
+  }
+
+  set {
+    name  = "controller.metrics.service.annotations.prometheus\\.io/port"
+    value = "10254"
+    type  = "string"
+  }
+
+  wait = true
+  depends_on = [
+    aws_eks_cluster.cluster
+  ]
+}
+
+resource "helm_release" "cert_manager" {
+  name             = "cert-manager"
+  repository       = "https://charts.jetstack.io"
+  chart            = "cert-manager"
+  namespace        = "cert-manager"
+  create_namespace = true
+  version          = var.cert_manager_version
+
+  set {
+    # We can manage CRDs from inside Helm itself, no need for a separate kubectl apply
+    name  = "installCRDs"
+    value = true
+  }
+  wait = true
+  depends_on = [
+    aws_eks_cluster.cluster
+  ]
+}
+
+##############################
+# SUPPORT OPTIONS
+##############################
+
+resource "helm_release" "prometheus" {
+  count            = var.enable_support_helm_charts ? 1 : 0
+  name             = "prometheus"
+  repository       = "https://prometheus-community.github.io/helm-charts"
+  chart            = "prometheus"
+  namespace        = "support"
+  create_namespace = true
+  version          = var.prometheus_version
+
+  set {
+    name  = "alertmanager.enabled"
+    value = false
+  }
+
+  set {
+    name  = "pushgateway.enabled"
+    value = false
+  }
+
+  set {
+    name  = "server.persistentVolume.size"
+    value = var.prometheus_disk_size
+  }
+
+  set {
+    name  = "server.retention"
+    value = "${var.prometheus_metrics_retention_days}d"
+  }
+
+  set {
+    name  = "server.ingress.enabled"
+    value = true
+  }
+
+  set {
+    name  = "server.ingress.hosts[0]"
+    value = var.prometheus_hostname
+  }
+
+  set {
+    # Double \\ is neded so the entire last part of the name is used as key
+    name  = "server.ingress.annotations.kubernetes\\.io/ingress\\.class"
+    value = "nginx"
+  }
+
+  set {
+    # We have a persistent disk attached, so the default (RollingUpdate)
+    # can sometimes get 'stuck' and require pods to be manually deleted.
+    name  = "strategy.type"
+    value = "Recreate"
+  }
+  # wait = true
+  depends_on = [
+    aws_eks_cluster.cluster
+  ]
+}
+
+
+resource "helm_release" "metrics-server" {
+  count      = var.enable_support_helm_charts ? 1 : 0
+  name       = "metrics-server"
+  repository = "https://charts.bitnami.com/bitnami"
+  chart      = "metrics-server"
+  version    = var.metrics_server_version
+  namespace  = "kube-system"
+
+  wait = true
+
+  depends_on = [
+    aws_eks_cluster.cluster
+  ]
+}
\ No newline at end of file
diff --git a/terraform/main.tf b/terraform/main.tf
new file mode 100644
index 00000000..c1ea9f20
--- /dev/null
+++ b/terraform/main.tf
@@ -0,0 +1,18 @@
+provider "aws" {
+  region = var.region
+  default_tags { tags = var.tags }
+}
+
+data "aws_availability_zones" "available" {
+  state = "available"
+
+  # https://docs.aws.amazon.com/eks/latest/userguide/network-reqs.html#cluster-subnets
+  exclude_zone_ids = ["use1-az3", "usw1-az2", "cac1-az3"]
+}
+
+locals {
+  cluster_prefix = "hotosm-${var.environment}"
+  cluster_admins = concat(var.cluster_admin_access_role_arns, [var.cluster_ci_access_role_arn])
+  azs            = slice(sort(data.aws_availability_zones.available.names), 0, min(4, length(data.aws_availability_zones.available.names)))
+  vpc_cidr       = "10.0.0.0/16"
+}
\ No newline at end of file
diff --git a/terraform/network.tf b/terraform/network.tf
new file mode 100644
index 00000000..60b44f8e
--- /dev/null
+++ b/terraform/network.tf
@@ -0,0 +1,13 @@
+module "vpc" {
+  source  = "terraform-aws-modules/vpc/aws"
+  version = "~> 5.0"
+
+  name               = "k8s-infra-${var.environment}"
+  cidr               = local.vpc_cidr
+  enable_nat_gateway = true
+  single_nat_gateway = true
+
+  azs             = local.azs
+  private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 4, k)]
+  public_subnets  = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 48)]
+}
diff --git a/terraform/nodes.tf b/terraform/nodes.tf
new file mode 100644
index 00000000..5ab866f9
--- /dev/null
+++ b/terraform/nodes.tf
@@ -0,0 +1,65 @@
+resource "aws_iam_role" "nodegroup" {
+  name                 = "${local.cluster_prefix}-cluster-nodegroup-role"
+  permissions_boundary = var.permissions_boundary
+
+  assume_role_policy = jsonencode({
+    Statement = [{
+      Action = "sts:AssumeRole"
+      Effect = "Allow"
+      Principal = {
+        Service = "ec2.amazonaws.com"
+      }
+    }]
+    Version = "2012-10-17"
+  })
+}
+
+resource "aws_iam_role_policy_attachment" "node_worker_policy_attachment" {
+  policy_arn = "arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy"
+  role       = aws_iam_role.nodegroup.name
+}
+
+resource "aws_iam_role_policy_attachment" "node_worker_cni_policy_attachment" {
+  policy_arn = "arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy"
+  role       = aws_iam_role.nodegroup.name
+}
+
+resource "aws_iam_role_policy_attachment" "node_worker_ecr_policy_attachment" {
+  policy_arn = "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"
+  role       = aws_iam_role.nodegroup.name
+}
+
+resource "aws_eks_node_group" "core_nodes" {
+  cluster_name    = aws_eks_cluster.cluster.name
+  node_group_name = "core"
+  node_role_arn   = aws_iam_role.nodegroup.arn
+
+  subnet_ids = module.vpc.private_subnets
+
+  instance_types = [var.instance_type]
+
+  capacity_type = var.capacity_type
+
+  scaling_config {
+    desired_size = 1
+    max_size     = var.max_instances
+    min_size     = 0
+  }
+
+  lifecycle {
+    # Allow cluster-autoscaler to change the size of nodepool without messing up terraform
+    ignore_changes = [scaling_config[0].desired_size]
+  }
+  update_config {
+    max_unavailable = 1
+  }
+
+  # Ensure that IAM Role permissions are created before and deleted after EKS Node Group handling.
+  # Otherwise, EKS will not be able to properly delete EC2 Instances and Elastic Network Interfaces.
+  depends_on = [
+    module.vpc,
+    aws_iam_role_policy_attachment.node_worker_policy_attachment,
+    aws_iam_role_policy_attachment.node_worker_cni_policy_attachment,
+    aws_iam_role_policy_attachment.node_worker_ecr_policy_attachment
+  ]
+}
diff --git a/terraform/outputs.tf b/terraform/outputs.tf
new file mode 100644
index 00000000..dbbb6651
--- /dev/null
+++ b/terraform/outputs.tf
@@ -0,0 +1,7 @@
+output "cluster_name" {
+  value = aws_eks_cluster.cluster.name
+}
+
+output "s3_backup_role" {
+  value = aws_iam_role.bucket_access.arn
+}
\ No newline at end of file
diff --git a/terraform/s3.tf b/terraform/s3.tf
new file mode 100644
index 00000000..766e72fc
--- /dev/null
+++ b/terraform/s3.tf
@@ -0,0 +1,40 @@
+resource "aws_s3_bucket" "data_stores" {
+  for_each = toset(var.bucket_names)
+  bucket   = each.key
+}
+
+resource "aws_iam_policy" "eks_s3_access" {
+  count = length(var.bucket_names) > 0 ? 1 : 0
+  name  = "EKSS3AccessPolicy"
+  policy = jsonencode({
+    Version = "2012-10-17"
+    Statement = [
+      {
+        Action = [
+          "s3:*"
+        ]
+        Effect = "Allow"
+        Resource = concat(
+          [for bucketname in var.bucket_names : "arn:aws:s3:::${bucketname}"],
+          [for bucketname in var.bucket_names : "arn:aws:s3:::${bucketname}/*"]
+        )
+      }
+    ]
+  })
+}
+
+locals {
+  s3_policy_arn = length(var.bucket_names) > 0 ? aws_iam_policy.eks_s3_access[0].arn : ""
+}
+
+resource "aws_iam_role" "bucket_access" {
+  name                 = "${local.cluster_prefix}-bucket-access"
+  assume_role_policy   = data.aws_iam_policy_document.assume_role_with_oidc.json
+  permissions_boundary = var.permissions_boundary
+}
+
+resource "aws_iam_role_policy_attachment" "s3_access" {
+  count      = length(var.bucket_names) > 0 ? 1 : 0
+  role       = aws_iam_role.bucket_access.name
+  policy_arn = local.s3_policy_arn
+}
\ No newline at end of file
diff --git a/terraform/variables.tf b/terraform/variables.tf
new file mode 100644
index 00000000..2e9f04e1
--- /dev/null
+++ b/terraform/variables.tf
@@ -0,0 +1,166 @@
+variable "environment" {
+  type        = string
+  default     = "development"
+  description = <<-EOT
+  Deploy environment
+  EOT
+}
+
+variable "region" {
+  type        = string
+  description = <<-EOT
+  AWS region to perform all our operations in.
+  EOT
+}
+
+variable "tags" {
+  type        = map(string)
+  default     = {}
+  description = <<-EOT
+  (Optional) AWS resource tags.
+  EOT
+}
+
+variable "permissions_boundary" {
+  type        = string
+  default     = null
+  sensitive   = true
+  description = <<-EOT
+  (Optional) ARN of the policy that is used to set the permissions boundary for
+  the role.
+  EOT
+}
+
+variable "bucket_names" {
+  description = <<-EOT
+  list of s3 buckets to create that you might need the nodes to have access to
+  EOT
+  type        = list(string)
+  default     = []
+}
+
+
+variable "instance_type" {
+  default     = "t3.large"
+  description = <<-EOT
+  AWS Instance type used for nodes.
+  EOT
+}
+
+variable "capacity_type" {
+  default     = "ON_DEMAND"
+  description = <<-EOT
+  Whether to use ON_DEMAND or SPOT instances.
+  EOT
+
+  validation {
+    condition     = contains(["ON_DEMAND", "SPOT"], var.capacity_type)
+    error_message = "The capacity_type value must be ON_DEMAND or SPOT."
+  }
+}
+
+variable "max_instances" {
+  default     = 10
+  type        = number
+  description = <<-EOT
+  Maximum number of instances the autoscaler will scale the cluster up to.
+  EOT
+}
+
+variable "prometheus_disk_size" {
+  default     = "16Gi"
+  description = <<-EOT
+  Amount of space to allocate to the disk storing prometheus metrics.
+  EOT
+}
+
+variable "prometheus_metrics_retention_days" {
+  default     = 180
+  type        = number
+  description = <<-EOT
+  Number of days to retain all prometheus metrics for
+  EOT
+}
+
+variable "prometheus_hostname" {
+  default     = ""
+  description = <<-EOT
+  The DNS host at which the prometheus server should be reachable.
+
+  Is just passed along to prometheus.server.ingress.hosts.
+  EOT
+}
+
+variable "kubernetes_version" {
+  type        = string
+  default     = "1.32"
+  description = <<-EOT
+  A version string that we append to certain resources to make them unique
+  EOT
+}
+
+variable "ebs_driver_version" {
+  type        = string
+  default     = "v1.41.0-eksbuild.1"
+  description = <<-EOT
+  EBS CSI Driver version
+  cmd: aws eks describe-addon-versions --kubernetes-version <kubernetes-version>
+  EOT
+}
+
+variable "cluster_autoscaler_version" {
+  default     = "9.46.6"
+  description = <<-EOT
+  Version of cluster autoscaler helm chart to install.
+  EOT
+}
+
+variable "cert_manager_version" {
+  default     = "1.17.1"
+  description = <<-EOT
+  Version of cert-manager helm chart to install.
+  EOT
+}
+
+variable "nginx_ingress_version" {
+  default     = "4.12.1"
+  description = <<-EOT
+  Version of the nginx ingress controller chart to install
+  EOT
+}
+
+variable "enable_support_helm_charts" {
+  default = false
+  type    = bool
+}
+
+variable "prometheus_version" {
+  default     = "25.3.1"
+  description = <<-EOT
+  Version of the grafana helm chart to install
+  EOT
+}
+
+variable "metrics_server_version" {
+  default     = "7.2.8"
+  description = <<-EOT
+  Version of the metrics-server
+  EOT
+}
+
+variable "cluster_admin_access_role_arns" {
+  type        = list(string)
+  default     = []
+  sensitive   = true
+  description = <<-EOT
+  (Optional) Roles allowed admin access to cluster
+  EOT
+}
+
+variable "cluster_ci_access_role_arn" {
+  type        = string
+  sensitive   = true
+  description = <<-EOT
+  CI deployer role to provide cluster access entry
+  EOT
+}
\ No newline at end of file
diff --git a/terraform/vars/production.tfvars b/terraform/vars/production.tfvars
new file mode 100644
index 00000000..cdee0beb
--- /dev/null
+++ b/terraform/vars/production.tfvars
@@ -0,0 +1,7 @@
+environment   = "production"
+region        = "us-east-1"
+instance_type = "t3.xlarge"
+bucket_names  = ["pgstac-backup", ]
+tags = {
+  project = "k8s-control"
+}
\ No newline at end of file
diff --git a/terraform/versions.tf b/terraform/versions.tf
new file mode 100644
index 00000000..46446d8a
--- /dev/null
+++ b/terraform/versions.tf
@@ -0,0 +1,19 @@
+terraform {
+  backend "s3" {
+    region         = var.region
+    bucket         = "hotosm-terraform"
+    key            = "${var.environment}/k8s-infra/terraform.tfstate"
+    dynamodb_table = "k8s-infra"
+  }
+
+  required_providers {
+    aws = {
+      source  = "hashicorp/aws"
+      version = "~> 5.8"
+    }
+    helm = {
+      source  = "hashicorp/helm"
+      version = "~>2.17.0"
+    }
+  }
+}
\ No newline at end of file


Reviews:
user: login: gadomski
body: Gave it a read-through, all seemed reasonable to me (though I'm pretty tf-n00b). Holding off on approval as CI is red and I'd like someone w/ more knowledge to give it a green check as well.
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-21T14:09:21Z
user: login: dakotabenjamin
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-21T14:22:31Z
user: login: spwoodcock
body: I haven't really reviewed the terraform stuff outside of a cursory overview, just the other content committed - looks good to me, nice work 😄
state: CHANGES_REQUESTED
author_association: MEMBER
submitted_at: 2025-05-21T15:08:35Z
user: login: aliziel
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-27T20:25:18Z
user: login: aliziel
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-27T20:27:47Z
user: login: gadomski
body: Code seems fine to my eye, @aliziel can you re-link (maybe pin) the link to the dev deploy? I did a quick search in Slack and couldn't find it.
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-27T22:45:18Z
user: login: gadomski
body: 🤦🏼 I self-served on the dev deploy. LGTM, ~though maybe someone from HOT should ✅ as well as it's their infra.~ but I don't have green-light review perms so we're good 😅 
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-05-28T11:15:25Z
user: login: spwoodcock
state: APPROVED
author_association: MEMBER
submitted_at: 2025-05-28T18:53:06Z

Review comments:
diff_hunk: @@ -0,0 +1,19 @@
+terraform {
+  backend "s3" {
+    region         = var.region
+    bucket         = "hotosm-terraform"
+    key            = "${var.environment}/k8s-infra/terraform.tfstate"
+    dynamodb_table = "k8s-infra"
path: terraform/versions.tf
user: login: dakotabenjamin
body: ~~should be `k8s-infra-locks`~~

JK I mislabeled it on the policy

created_at: 2025-05-21T14:22:24Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,64 @@
+name: Deploy Terraform
+on:
+  push:
+    branches:
+      # - main
path: .github/workflows/ci.yaml
user: login: spwoodcock
body: I doubt we will have a dev, stage, and prod cluster - it will cost too much.

We may consider in future having a small dev cluster, then deploying stage into the prod cluster per app (to replicate prod).

Overall I think we should probably just use the `main` branch as a way to track the production cluster state 👍

(Can anyone think of a better way to handle this?)
created_at: 2025-05-21T14:56:31Z
author_association: MEMBER
path: .github/workflows/ci.yaml
user: login: spwoodcock
body: Looks good to me - this file will get us across the line 👍

Are these workflows defined by devops at NAXA any use?

https://github.com/hotosm/gh-workflows/blob/main/.github/workflows/terragrunt-plan.yml

https://github.com/hotosm/gh-workflows/blob/main/.github/workflows/terragrunt-apply.yml

(not sure we need TerraGrunt though, based on my previous comment about single branch / single cluster)
created_at: 2025-05-21T15:00:41Z
author_association: MEMBER
path: Makefile
user: login: spwoodcock
body: Also not a hard requirement or anything, but I have been using Justfile instead of Makefile for a while now & would recommend.

Make is a build tool commonly abused as a task runner. Just is an excellent improvement, fixing many pitfalls of Make and adding lots of new features specific to running tasks.

Repo: http://github.com/casey/just

Example: https://github.com/hotosm/fmtm/tree/development/contrib/just

Related to the github workflows - I'm actually planning on refactoring lots of our workflow usage to simply use Just. We can define the commands in the Justfile, then simply have (less platform-specific) workflows defined to run the Just commands. Makes total sense to me for deploying infra - making is replicatable via CLI as well as CI
created_at: 2025-05-21T15:04:19Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,64 @@
+name: Deploy Terraform
+on:
+  push:
+    branches:
+      # - main
path: .github/workflows/ci.yaml
user: login: aliziel
body: Addressed in 8a2661a3a0dc1b76f7071b7816c6211d16ad88f1

I'll also reopen this PR against `main`
created_at: 2025-05-27T20:25:18Z
author_association: COLLABORATOR
path: .github/workflows/ci.yaml
user: login: aliziel
body: Added a similar non-Terragrunt [action](https://github.com/marketplace/actions/terraform-opentofu-via-pull-request) to upload plan artifacts in 86d121c7fc00cdb0dd67698fcb8cfcee114f88a1
created_at: 2025-05-27T20:27:47Z
author_association: COLLABORATOR

PR comments:
user: login: aliziel
created_at: 2025-05-20T22:07:37Z
body: @gadomski @ceholden - tried to add you as reviewers but unable to, would love any thoughts/feedback/edits/etc.
author_association: COLLABORATOR
user: login: dakotabenjamin
created_at: 2025-05-21T17:45:08Z
body: Some permissions fixed, but as I was testing tofu ran into an error: 
```
OpenTofu planned the following actions, but then encountered a problem:
  # data.aws_iam_policy_document.assume_role_with_oidc will be read during apply
  # (config refers to values not yet known)
 <= data "aws_iam_policy_document" "assume_role_with_oidc" {
      + id            = (known after apply)
      + json          = (known after apply)
      + minified_json = (known after apply)
      + statement {
          + actions = [
              + "sts:AssumeRoleWithWebIdentity",
            ]
          + effect  = "Allow"
          + principals {
              + identifiers = [
                  + (known after apply),
                ]
              + type        = "Federated"
            }
        }
    }
  # data.aws_iam_policy_document.cluster_autoscaler will be read during apply
Error: Invalid for_each argument
  on cluster.tf line 114, in resource "aws_eks_access_entry" "admin":
 114:   for_each = toset(var.cluster_admin_access_role_arns)
    ├────────────────
    │ var.cluster_admin_access_role_arns has a sensitive value
Sensitive values, or values derived from sensitive values, cannot be used as
for_each arguments. If used, the sensitive value could be exposed as a
resource instance key.
  # (config refers to values not yet known)
  ```
author_association: MEMBER
user: login: aliziel
created_at: 2025-05-27T20:29:19Z
body: > Some permissions fixed, but as I was testing tofu ran into an error:
> 
> ```
> OpenTofu planned the following actions, but then encountered a problem:
>   # data.aws_iam_policy_document.assume_role_with_oidc will be read during apply
>   # (config refers to values not yet known)
>  <= data "aws_iam_policy_document" "assume_role_with_oidc" {
>       + id            = (known after apply)
>       + json          = (known after apply)
>       + minified_json = (known after apply)
>       + statement {
>           + actions = [
>               + "sts:AssumeRoleWithWebIdentity",
>             ]
>           + effect  = "Allow"
>           + principals {
>               + identifiers = [
>                   + (known after apply),
>                 ]
>               + type        = "Federated"
>             }
>         }
>     }
>   # data.aws_iam_policy_document.cluster_autoscaler will be read during apply
> Error: Invalid for_each argument
>   on cluster.tf line 114, in resource "aws_eks_access_entry" "admin":
>  114:   for_each = toset(var.cluster_admin_access_role_arns)
>     ├────────────────
>     │ var.cluster_admin_access_role_arns has a sensitive value
> Sensitive values, or values derived from sensitive values, cannot be used as
> for_each arguments. If used, the sensitive value could be exposed as a
> resource instance key.
>   # (config refers to values not yet known)
> ```

Refactored in ef0154768c3c2e5e1172a03932e43faa92348cf6 — workflow hasn't rerun because we're doing single env (see above). Will verify against `main`.
author_association: COLLABORATOR
user: login: github-actions[bot]
created_at: 2025-05-27T20:44:34Z
body: <!-- placeholder-1 -->
```fish
tofu fmt -chdir=/terraform -check -diff -recursive
```
<!-- placeholder-2 -->

<!-- placeholder-3 -->
<details><summary>View output.</br>

<!-- placeholder-4 -->
###### By @aliziel at 2025-05-27T20:46:36Z [(view log)](https://github.com/hotosm/k8s-infra/actions/runs/15285378103/job/42994187083#step:5:1).
</summary>

```diff
Error handling -chdir option: chdir /terraform: no such file or directory
```
</details>
<!-- placeholder-5 -->
<!-- tofu-16-6c3d67a949c7e5212cc5a2c6e1486235.tfplan -->
<!-- placeholder-6 -->
author_association: NONE
user: login: github-actions[bot]
created_at: 2025-05-27T20:55:53Z
body: <!-- placeholder-1 -->
```fish
tofu apply -chdir=terraform tfplan
```
<!-- placeholder-2 -->

<details><summary>Diff of 54 changes.</summary>

```diff
~ data.aws_iam_policy_document.assume_role_with_oidc will be read during apply
# (config refers to values not yet known)
~ data.aws_iam_policy_document.cluster_autoscaler will be read during apply
# (config refers to values not yet known)
~ data.tls_certificate.cluster_oidc_certificate will be read during apply
# (config refers to values not yet known)
+ aws_eks_access_entry.admin_access[0] will be created
+ aws_eks_access_policy_association.admin_policy[0] will be created
+ aws_eks_addon.ebs_provisioner will be created
+ aws_eks_cluster.cluster will be created
+ aws_eks_node_group.core_nodes will be created
+ aws_iam_openid_connect_provider.cluster_oidc will be created
+ aws_iam_policy.cluster_autoscaler will be created
+ aws_iam_policy.eks_s3_access[0] will be created
+ aws_iam_role.bucket_access will be created
+ aws_iam_role.cluster_autoscaler will be created
+ aws_iam_role.cluster_control_plane will be created
+ aws_iam_role.ebs_provisioner will be created
+ aws_iam_role.nodegroup will be created
+ aws_iam_role_policy_attachment.cluster_autoscaler will be created
+ aws_iam_role_policy_attachment.cluster_control_plane will be created
+ aws_iam_role_policy_attachment.ebs_provisioner will be created
+ aws_iam_role_policy_attachment.node_worker_cni_policy_attachment will be created
+ aws_iam_role_policy_attachment.node_worker_ecr_policy_attachment will be created
+ aws_iam_role_policy_attachment.node_worker_policy_attachment will be created
+ aws_iam_role_policy_attachment.s3_access[0] will be created
+ aws_s3_bucket.data_stores["pgstac-backup"] will be created
+ helm_release.autoscaler will be created
+ helm_release.cert_manager will be created
+ helm_release.ingress will be created
+ module.vpc.aws_default_network_acl.this[0] will be created
+ module.vpc.aws_default_route_table.default[0] will be created
+ module.vpc.aws_default_security_group.this[0] will be created
+ module.vpc.aws_eip.nat[0] will be created
+ module.vpc.aws_internet_gateway.this[0] will be created
+ module.vpc.aws_nat_gateway.this[0] will be created
+ module.vpc.aws_route.private_nat_gateway[0] will be created
+ module.vpc.aws_route.public_internet_gateway[0] will be created
+ module.vpc.aws_route_table.private[0] will be created
+ module.vpc.aws_route_table.public[0] will be created
+ module.vpc.aws_route_table_association.private[0] will be created
+ module.vpc.aws_route_table_association.private[1] will be created
+ module.vpc.aws_route_table_association.private[2] will be created
+ module.vpc.aws_route_table_association.private[3] will be created
+ module.vpc.aws_route_table_association.public[0] will be created
+ module.vpc.aws_route_table_association.public[1] will be created
+ module.vpc.aws_route_table_association.public[2] will be created
+ module.vpc.aws_route_table_association.public[3] will be created
+ module.vpc.aws_subnet.private[0] will be created
+ module.vpc.aws_subnet.private[1] will be created
+ module.vpc.aws_subnet.private[2] will be created
+ module.vpc.aws_subnet.private[3] will be created
+ module.vpc.aws_subnet.public[0] will be created
+ module.vpc.aws_subnet.public[1] will be created
+ module.vpc.aws_subnet.public[2] will be created
+ module.vpc.aws_subnet.public[3] will be created
+ module.vpc.aws_vpc.this[0] will be created
```
</details>
<!-- placeholder-3 -->
<details><summary>Error: Saved plan is stale</br>

<!-- placeholder-4 -->
###### By @dakotabenjamin at 2025-05-29T12:23:53-07:00 [(view log)](https://github.com/hotosm/k8s-infra/actions/runs/15331785085/job/43488955530#step:5:1).
</summary>

```hcl

Error: Saved plan is stale

The given plan file can no longer be applied because the state was changed by
another operation after the plan was created.
```
</details>
<!-- placeholder-5 -->
<!-- tofu-16-f185c4fc74bdb34269b446993439ba84.tfplan -->
<!-- placeholder-6 -->
author_association: NONE