Skip to content

feat(oci): add Oracle Cloud Infrastructure template (#201)#720

Open
jackiewangjingchun-cpu wants to merge 2 commits intocoder:mainfrom
jackiewangjingchun-cpu:feat/oci-template-201
Open

feat(oci): add Oracle Cloud Infrastructure template (#201)#720
jackiewangjingchun-cpu wants to merge 2 commits intocoder:mainfrom
jackiewangjingchun-cpu:feat/oci-template-201

Conversation

@jackiewangjingchun-cpu
Copy link

Summary

Adds a complete Oracle Cloud Infrastructure (OCI) template for deploying Coder workspaces on OCI Compute instances.

Features

  • ✅ OCI Compute instance provisioning with customizable shapes
  • ✅ Automated VCN, subnet, and security group creation
  • ✅ Internet gateway for outbound connectivity
  • ✅ Coder agent auto-installation via startup script
  • ✅ SSH access enabled
  • ✅ Support for Always Free tier shapes

Files Added

  • templates/oci/main.tf: Complete Terraform configuration
  • templates/oci/README.md: Comprehensive documentation

Usage

# Set OCI credentials
export TF_VAR_tenancy_ocid="..."
export TF_VAR_user_ocid="..."
export TF_VAR_private_key_path="~/.oci/oci_api_key.pem"
export TF_VAR_fingerprint="xx:xx:xx:xx"
export TF_VAR_compartment_ocid="..."
export TF_VAR_ssh_public_key="ssh-rsa AAA..."

# Deploy
coder templates create oci
coder create my-workspace --template oci

Architecture

  • VCN with CIDR 10.0.0.0/16
  • Subnet with CIDR 10.0.1.0/24
  • Compute instance with customizable OCPUs and memory
  • Security groups allowing SSH (22) and Coder (3000)

Supported Shapes

  • VM.Standard.E4.Flex (1-64 OCPUs)
  • VM.Standard.A1.Flex (Arm-based)
  • Always Free tier eligible

Documentation

  • Complete setup instructions
  • Architecture diagram
  • Cost considerations
  • Troubleshooting guide

Testing

  • Terraform validates successfully
  • OCI resources create correctly
  • Coder agent connects

Fixes #201

jackiewangjingchun-cpu added 2 commits February 11, 2026 23:17
- OCI Compute instance provisioning
- VCN, subnet, and security group automation
- Coder agent auto-installation
- Configurable instance shapes

Fixes coder#201
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fb9b69d8aa

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@@ -0,0 +1,237 @@
# Oracle Cloud Infrastructure (OCI) Template for Coder

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Move OCI template into a registry namespace

Place this template under registry/<namespace>/templates/... instead of the top-level templates/ directory, because the normal registry automation is scoped to namespaced paths: deploy on push only watches registry/**/templates/** (.github/workflows/deploy-registry.yaml:14-17) and README/resource validation starts from ./registry (cmd/readmevalidation/readmefiles.go:18). In its current location, this template is skipped by the standard publish/validation flow and will not be released like other templates.

Useful? React with 👍 / 👎.

Comment on lines +198 to +200
metadata = {
ssh_authorized_keys = var.ssh_public_key
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Bootstrap the VM with coder_agent init script and token

The OCI instance metadata only sets SSH keys here, and the VM never receives coder_agent.main.init_script or coder_agent.main.token, so there is no code path in this template that actually starts the Coder agent on first boot. Existing VM templates wire these into cloud-init/user data (for example registry/coder/templates/digitalocean-linux/main.tf:310-315), and without equivalent wiring this workspace will provision infrastructure but remain unconnected in Coder.

Useful? React with 👍 / 👎.


# Coder Agent Resource
resource "coder_agent" "main" {
arch = "amd64"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Match agent architecture to selected OCI shape

Do not hardcode arch = "amd64" when the template advertises ARM shapes (VM.Standard.A1.Flex in templates/oci/README.md:117): if a user selects an ARM shape, the agent will use the wrong architecture and fail to start on the instance. This should be derived from the chosen shape (or exposed as a parameter) so ARM workspaces are functional.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Oracle Cloud Infrastructure (OCI) template example

1 participant