Use when creating new Terraform/OpenTofu components or modifying existing ones. Covers required files, catalog defaults, stack configuration, and naming conventions.
Scope: This skill is generic and applies to any Cloud Posse reference architecture project. It covers patterns for vendoring and creating Terraform components that are consistent across all customers.
Components are opinionated Terraform root modules that implement a specific AWS resource with predefined conventions.
Always check for existing components first. Creating new components adds maintenance burden.
ls components/terraform/
Many use cases can be solved by configuring existing generic components via catalog:
iam-role - Any IAM role. Create stacks/catalog/iam-role/my-role.yaml instead of a new component.s3-bucket - Any S3 bucket with standard configurations.lambda - Lambda functions with common patterns.Browse https://docs.cloudposse.com/components/library/ for pre-built components. Common ones:
eks/cluster - Kubernetesaurora-postgres, rds - Databaseselasticache-redis - Cachingecs, ecs-service - Container workloadss3-bucket, dynamodb, sqs-queue - Storage and messagingcloudwatch-logs, sns-topic - Monitoring and notifications| Resource | Location |
| ---------------------- | ---------------------------------------------------------- |
| Component Library Docs | https://docs.cloudposse.com/components/library/ |
| Component Repositories | github.com/cloudposse-terraform-components/aws-<service> |
| Mixins Repository | github.com/cloudposse-terraform-components/mixins |
Find latest version:
gh release view --repo cloudposse-terraform-components/aws-<component> --json tagName
component.yaml:mkdir -p components/terraform/<component-name>
components/terraform/<component-name>/component.yaml:apiVersion: atmos/v1
kind: ComponentVendorConfig
spec:
source:
uri: github.com/cloudposse-terraform-components/aws-<component>.git//src?ref={{ .Version }}
version: <latest-version> # Use gh release view to find this
included_paths:
- "**/**"
excluded_paths:
- "providers.tf"
mixins:
# Use provider mixin without account-map dependency (for single-account deployments)
- uri: https://raw.githubusercontent.com/cloudposse-terraform-components/mixins/{{ .Version }}/src/mixins/provider-without-account-map.tf
version: v0.3.2
filename: providers.tf
<!-- prettier-ignore-end -->
atmos vendor pull -c <component-name>
Create a new component when:
Teralithic components (all-in-one) are appropriate when:
Avoid custom components when:
Every new component requires three parts:
components/terraform/<component-name>/)Required files (copy from an existing component like ecs):
context.tf - Always identical across all components. Copy from any existing component. Provides Cloud Posse's
null-label context for consistent naming.providers.tf - Standard provider configuration. Copy from an existing component. Includes the
account_map_enabled variable and dummy iam_roles module for compatibility.versions.tf - OpenTofu/Terraform and provider version constraintsvariables.tf - Component-specific input variablesmain.tf - Main resource definitionsoutputs.tf - Output valuesNote on remote-state.tf: Avoid creating remote-state.tf files for new components. Instead, use Atmos functions
(!terraform.state) in stack YAML to pass values from other components. This keeps components simpler and moves
cross-component wiring to the stack configuration layer.
stacks/catalog/<component-name>/defaults.yaml)Define organization-wide default values for the component, including dependency lookups:
components:
terraform:
<component-name>/defaults:
metadata:
component: <component-name>
type: abstract # Makes this a base configuration, not directly deployable
vars:
enabled: true
name: <component-name>
# Static defaults
some_setting: "default-value"
# Dynamic lookups - resolved at plan time based on current stack
vpc_id: !terraform.state vpc vpc_id
subnet_ids: !terraform.state vpc private_subnet_ids
stacks/orgs/acme/<tenant>/<stage>/<region>/<layer>.yaml)Import the catalog - often no component block is needed if catalog defaults are complete:
import:
- orgs/acme/plat/dev/_defaults
- mixins/region/us-east-1
- catalog/<component-name>/defaults
If overrides are needed:
import:
- catalog/<component-name>/defaults
components:
terraform:
<component-name>:
vars:
# Account/region-specific overrides only
some_setting: "override-value"
ecs-adot-collector not just adot-collector)iam-role/grafana-cloudwatch-access,
grafana/datasource/cloudwatch)Stack files in stacks/orgs/acme/ mirror the AWS account structure:
orgs/acme/core/ - Core accounts (root, audit, security, network, auto, artifacts)orgs/acme/plat/ - Platform accounts (sandbox, dev, staging, prod)Within each stage, organized by region:
global-region/ - Global (us-east-1) resources like IAMus-east-2/ - Regional resourcesRegional stack files are typically split by layer:
foundation.yaml - VPC, networking, base infrastructureplatform.yaml - Shared platform services (ECS clusters, databases)app.yaml - Application-specific resourcesnpx skills add cloudposse/developing-components下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer