-
Notifications
You must be signed in to change notification settings - Fork 78
Add Cloud DevOps workspace template for EKS #518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nboyers
wants to merge
9
commits into
main
Choose a base branch
from
add-cloud-dev-template
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e346077
Add Cloud DevOps workspace template for EKS
65c1a18
Add namespace README for nboyers
ce64c56
Add namespace README for nboyers
70f3673
Refresh .gitignore to stop tracking ignored files
4c9df77
chore: format files to pass bun fmt:ci
160358d
chore: format to satisfy fmt:ci
1f60d23
Update registry/nboyers/templates/cloud-dev/README.md
nboyers 2b7b629
Merge branch 'main' into add-cloud-dev-template
nboyers db71ac0
Merge branch 'main' into add-cloud-dev-template
DevelopmentCats File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # Local and OS files | ||
| .DS_Store | ||
| Thumbs.db | ||
| *.log | ||
| *.tmp | ||
| *.swp | ||
| *.bak | ||
|
|
||
| # Terraform | ||
| .terraform/ | ||
| .terraform.lock.hcl | ||
| terraform.tfstate | ||
| terraform.tfstate.backup | ||
| crash.log | ||
|
|
||
| # Node / Bun / Python / other tool artifacts | ||
| node_modules/ | ||
| bun.lockb | ||
| package-lock.json | ||
| __pycache__/ | ||
| *.pyc | ||
|
|
||
| # Cloud credentials and keys | ||
| *.pem | ||
| *.key | ||
| *.p12 | ||
| *.json | ||
| *.env | ||
| .envrc | ||
| aws-credentials | ||
| gcp.json | ||
| azure-creds.json | ||
|
|
||
| # Archives | ||
| *.zip | ||
| *.tar.gz | ||
| *.tgz | ||
|
|
||
| # Workspace artifacts | ||
| workspace/ | ||
| output/ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --- | ||
| display_name: "Noah Boyers" | ||
| bio: "Cloud & DevOps engineer with an MBA, building scalable multi-cloud infrastructure." | ||
| avatar: "./.images/avatar.png" | ||
| github: "noahboyers" | ||
| linkedin: "https://www.linkedin.com/in/nboyers" | ||
| website: "https://nobosoftware.com" | ||
| support_email: "hello@nobosoftware.com" | ||
| status: "community" | ||
| --- | ||
|
|
||
| # Noah Boyers | ||
|
|
||
| Cloud and DevOps engineer focused on scalable, secure, and automated infrastructure across AWS, Azure, and GCP. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| --- | ||
| display_name: "Cloud DevOps Workspace" | ||
| description: "A multi-cloud DevOps workspace that runs on Amazon EKS and provides authenticated access to AWS, Azure, and GCP." | ||
| icon: "https://raw.githubusercontent.com/coder/coder-icons/main/icons/cloud-devops.svg" | ||
| tags: ["devops", "eks", "multi-cloud", "terraform", "cdk", "pulumi"] | ||
| --- | ||
|
|
||
| # Cloud DevOps Workspace | ||
|
|
||
| A secure, company-standard DevOps environment for platform and cloud engineers. | ||
|
|
||
| This template deploys workspaces **into an existing Amazon EKS cluster** and provides developers with tools and credentials to work with **AWS, Azure, and GCP** from inside their workspace. | ||
|
|
||
| Supports multiple Infrastructure-as-Code frameworks — **Terraform**, **AWS CDK**, and **Pulumi** — for flexible, multi-cloud development. | ||
|
|
||
| ## Features | ||
|
|
||
| - **Multi-Cloud Ready** — authenticate to AWS, Azure, or GCP from a single workspace | ||
| - **Runs on EKS** — leverages existing Kubernetes infrastructure for scaling and security | ||
| - **IaC Tools Included** — Terraform, Terragrunt, CDK, Pulumi, tfsec, and more | ||
| - **Secure Isolation** — each workspace runs in its own Kubernetes namespace | ||
| - **Configurable Auth** — supports IRSA (AWS), Federated Identity (Azure), and WIF (GCP) | ||
|
|
||
| ## Variables | ||
|
|
||
| | Variable | Description | Type | Default | | ||
| | ------------------------------------------------------------- | --------------------------------------------------------------- | ------ | ----------- | | ||
| | `host_cluster_name` | EKS cluster name where workspaces are deployed | string | — | | ||
| | `iac_tool` | Infrastructure-as-Code framework (`terraform`, `cdk`, `pulumi`) | string | `terraform` | | ||
| | `enable_aws` | Enable AWS authentication and tools | bool | `true` | | ||
| | `enable_azure` | Enable Azure authentication and tools | bool | `false` | | ||
| | `enable_gcp` | Enable GCP authentication and tools | bool | `false` | | ||
| | `aws_access_key_id` / `aws_secret_access_key` | AWS credentials (optional) | string | `""` | | ||
| | `azure_client_id` / `azure_client_secret` / `azure_tenant_id` | Azure credentials (optional) | string | `""` | | ||
| | `gcp_service_account` | GCP Service Account JSON (optional) | string | `""` | | ||
|
|
||
| ## Runtime Architecture | ||
|
|
||
| | Layer | Platform | Purpose | | ||
| | ----------------------- | ------------------ | ------------------------------------------------------------ | | ||
| | **Infrastructure** | Amazon EKS | Where Coder deploys and runs the workspaces | | ||
| | **Workspace Container** | Ubuntu-based image | Developer environment (Terraform, CDK, Pulumi, CLIs) | | ||
| | **Cloud Access** | AWS / Azure / GCP | Target environments for deploying infrastructure or services | | ||
|
|
||
| ## Required Permissions and Setup Steps | ||
|
|
||
| This template **runs on EKS** but allows developers inside the workspace to authenticate with **AWS, Azure, or GCP** using their own credentials or service identities. | ||
|
|
||
| ### Coder & Infrastructure (Admin Setup) | ||
|
|
||
| Your Coder deployment must have: | ||
|
|
||
| - Network access to an **existing EKS cluster** | ||
| - The Coder Helm chart installed and healthy | ||
| - Terraform configured with access to the EKS API | ||
|
|
||
| #### Minimum AWS IAM Permissions | ||
|
|
||
| For the identity running the template (Coder service account, Terraform runner, or user): | ||
|
|
||
| ```json | ||
| { | ||
| "Effect": "Allow", | ||
| "Action": [ | ||
| "eks:DescribeCluster", | ||
| "eks:ListClusters", | ||
| "sts:GetCallerIdentity", | ||
| "sts:AssumeRole" | ||
| ], | ||
| "Resource": "*" | ||
| } | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| terraform { | ||
| required_providers { | ||
| coder = { | ||
| source = "coder/coder" | ||
| version = "~> 0.23" | ||
| } | ||
| kubernetes = { | ||
| source = "hashicorp/kubernetes" | ||
| version = "~> 2.23" | ||
| } | ||
| aws = { | ||
| source = "hashicorp/aws" | ||
| version = "~> 5.0" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| # --- Coder workspace context --- | ||
| data "coder_workspace" "me" {} | ||
| data "coder_workspace_owner" "me" {} | ||
|
|
||
| # --- EKS connection --- | ||
| data "aws_eks_cluster" "eks" { | ||
| name = trimspace(var.host_cluster_name) | ||
| } | ||
|
|
||
|
|
||
| data "aws_eks_cluster_auth" "eks" { | ||
| name = trimspace(var.host_cluster_name) | ||
| } | ||
|
|
||
| provider "kubernetes" { | ||
| host = data.aws_eks_cluster.eks.endpoint | ||
| cluster_ca_certificate = base64decode(data.aws_eks_cluster.eks.certificate_authority[0].data) | ||
| token = data.aws_eks_cluster_auth.eks.token | ||
| } | ||
|
|
||
| # --- Namespace per workspace --- | ||
| resource "kubernetes_namespace" "workspace" { | ||
| metadata { | ||
| name = "coder-${data.coder_workspace_owner.me.name}-${data.coder_workspace.me.name}" | ||
| labels = { | ||
| "coder.workspace" = data.coder_workspace.me.name | ||
| "coder.owner" = data.coder_workspace_owner.me.name | ||
| } | ||
| } | ||
| } | ||
|
|
||
| # --- ServiceAccount (IRSA optional) --- | ||
| resource "kubernetes_service_account" "workspace" { | ||
| metadata { | ||
| name = "coder-${data.coder_workspace_owner.me.name}-${data.coder_workspace.me.name}" | ||
| namespace = kubernetes_namespace.workspace.metadata[0].name | ||
|
|
||
| annotations = var.enable_aws && var.aws_role_arn != "" ? { | ||
| "eks.amazonaws.com/role-arn" = var.aws_role_arn | ||
| } : {} | ||
| } | ||
| } | ||
|
|
||
| # --- Coder Agent definition --- | ||
| resource "coder_agent" "main" { | ||
| os = "linux" | ||
| arch = "amd64" | ||
|
|
||
| startup_script = file("${path.module}/scripts/setup-workspace.sh") | ||
|
|
||
| env = { | ||
| # IaC tool & cloud toggles | ||
| IAC_TOOL = var.iac_tool | ||
| ENABLE_AWS = tostring(var.enable_aws) | ||
| ENABLE_AZURE = tostring(var.enable_azure) | ||
| ENABLE_GCP = tostring(var.enable_gcp) | ||
|
|
||
| # Developer credentials | ||
| AWS_ACCESS_KEY_ID = var.aws_access_key_id | ||
| AWS_SECRET_ACCESS_KEY = var.aws_secret_access_key | ||
| AZURE_CLIENT_ID = var.azure_client_id | ||
| AZURE_TENANT_ID = var.azure_tenant_id | ||
| AZURE_CLIENT_SECRET = var.azure_client_secret | ||
| GCP_SERVICE_ACCOUNT = var.gcp_service_account | ||
| } | ||
| } | ||
|
|
||
| # --- Kubernetes Pod (runs workspace container) --- | ||
| resource "kubernetes_pod" "workspace" { | ||
| count = data.coder_workspace.me.start_count | ||
|
|
||
| metadata { | ||
| name = "coder-${data.coder_workspace_owner.me.name}-${data.coder_workspace.me.name}" | ||
| namespace = kubernetes_namespace.workspace.metadata[0].name | ||
| labels = { | ||
| "app" = "coder-workspace" | ||
| "coder.owner" = data.coder_workspace_owner.me.name | ||
| "coder.agent" = "true" | ||
| } | ||
| } | ||
|
|
||
| spec { | ||
| service_account_name = kubernetes_service_account.workspace.metadata[0].name | ||
|
|
||
| container { | ||
| name = "workspace" | ||
| image = "codercom/enterprise-base:ubuntu" | ||
| command = ["/bin/bash", "-c", coder_agent.main.init_script] | ||
|
|
||
| env { | ||
| name = "CODER_AGENT_TOKEN" | ||
| value = coder_agent.main.token | ||
| } | ||
|
|
||
| resources { | ||
| requests = { cpu = "500m", memory = "1Gi" } | ||
| limits = { cpu = "2", memory = "4Gi" } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| depends_on = [coder_agent.main] | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.