### Clone Example App Source: https://github.com/cloudposse/docs/blob/master/docs/layers/software-delivery/ecs-ecspresso/setup.mdx Clone the example application repository locally to begin the setup process. ```bash git clone git@github.com:acme/example-app-on-ecs.git ``` -------------------------------- ### Component Test Output Example Source: https://github.com/cloudposse/docs/blob/master/docs/community/contribute/component-testing.mdx This is an example of the output you can expect when running the initial component tests. It shows the setup process, dependency vendorization, and test execution. ```console ➜ test git:(main) go test -v -timeout 1h --only-deploy-dependencies === RUN TestRunSuite 2025/03/07 14:13:34 INFO TestRunSuite: setup → started 2025/03/07 14:13:34 INFO TestRunSuite: tests will be run in temp directory path=/var/folders/1l/hcm6nfms6g58mdrpwcxklsvh0000gn/T/atmos-test-helper3047340212 2025/03/07 14:13:34 INFO TestRunSuite: terraform state for tests will be saved in state directory path=/var/folders/1l/hcm6nfms6g58mdrpwcxklsvh0000gn/T/atmos-test-helper3047340212/state 2025/03/07 14:13:34 INFO TestRunSuite: setup/bootstrap temp dir → completed 2025/03/07 14:13:34 INFO TestRunSuite: setup/copy component to temp dir → started 2025/03/07 14:13:34 INFO TestRunSuite: setup/copy component to temp dir → completed 2025/03/07 14:13:34 INFO TestRunSuite: vendor dependencies → started TestRunSuite 2025-03-07T14:13:35+01:00 retry.go:91: atmos [vendor pull] TestRunSuite 2025-03-07T14:13:35+01:00 logger.go:67: Running command atmos with args [vendor pull] TestRunSuite 2025-03-07T14:13:35+01:00 logger.go:67: Processing vendor config file 'vendor.yaml' TestRunSuite 2025-03-07T14:13:35+01:00 logger.go:67: Pulling sources for the component 'account-map' from 'github.com/cloudposse/terraform-aws-components.git//modules/account-map?ref=1.520.0' into 'components/terraform/account-map' 2025/03/07 14:13:42 INFO TestRunSuite: vendor dependencies → completed 2025/03/07 14:13:42 INFO TestRunSuite: deploy dependencies → started 2025/03/07 14:13:42 INFO no dependencies to deploy 2025/03/07 14:13:42 INFO TestRunSuite: deploy dependencies → completed 2025/03/07 14:13:42 INFO TestRunSuite: setup → completed 2025/03/07 14:13:42 WARN TestRunSuite: teardown → skipped --- PASS: TestRunSuite (8.28s) PASS ok test 9.142s ``` -------------------------------- ### Install and Start Docusaurus Dev Server Source: https://github.com/cloudposse/docs/blob/master/CLAUDE.md Commands to install project dependencies and start the local development server for Docusaurus. ```bash npm install # Install dependencies npm start # Start dev server (localhost:3000) npm run build # Production build npm run serve # Serve production build locally ``` -------------------------------- ### Component Test Output Example Source: https://github.com/cloudposse/docs/blob/master/docs/community/contribute/component-testing.mdx Example output from running a component test, showing the setup, dependency deployment, and test execution phases. ```console === RUN TestRunSuite 2025/03/07 14:13:34 INFO TestRunSuite: setup → started 2025/03/07 14:13:34 INFO TestRunSuite: tests will be run in temp directory path=/var/folders/1l/hcm6nfms6g58mdrpwcxklsvh0000gn/T/atmos-test-helper3047340212 2025/03/07 14:13:34 INFO TestRunSuite: terraform state for tests will be saved in state directory path=/var/folders/1l/hcm6nfms6g58mdrpwcxklsvh0000gn/T/atmos-test-helper3047340212/state 2025/03/07 14:13:34 INFO TestRunSuite: setup/bootstrap temp dir → completed 2025/03/07 14:13:34 INFO TestRunSuite: setup/copy component to temp dir → started 2025/03/07 14:13:34 INFO TestRunSuite: setup/copy component to temp dir → completed 2025/03/07 14:13:34 INFO TestRunSuite: vendor dependencies → started TestRunSuite 2025-03-07T14:13:35+01:00 retry.go:91: atmos [vendor pull] TestRunSuite 2025-03-07T14:13:35+01:00 logger.go:67: Running command atmos with args [vendor pull] TestRunSuite 2025-03-07T14:13:35+01:00 logger.go:67: Processing vendor config file 'vendor.yaml' TestRunSuite 2025-03-07T14:13:35+01:00 logger.go:67: Pulling sources for the component 'account-map' from 'github.com/cloudposse/terraform-aws-components.git//modules/account-map?ref=1.520.0' into 'components/terraform/account-map' 2025/03/07 14:13:42 INFO TestRunSuite: vendor dependencies → completed 2025/03/07 17:38:24 INFO TestRunSuite: deploy dependencies → started 2025/03/07 17:38:24 INFO deploying dependency component=vpc stack=default-test TestRunSuite 2025-03-07T17:38:24+01:00 retry.go:91: atmos [terraform apply vpc -s default-test -input=false -auto-approve -var attributes=["rydpt4"] -no-color -lock=false] TestRunSuite 2025-03-07T17:38:24+01:00 logger.go:67: Running command atmos with args [terraform apply vpc -s default-test -input=false -auto-approve -var attributes=["rydpt4"] -no-color -lock=false] ... 2025/03/07 17:43:27 INFO TestRunSuite: deploy dependencies → completed 2025/03/07 17:43:27 INFO TestRunSuite: setup → completed 2025/03/07 17:43:27 WARN TestRunSuite: teardown → skipped --- PASS: TestRunSuite (322.74s) PASS ok test 324.052s ``` -------------------------------- ### Start Local Web Server with Make Source: https://github.com/cloudposse/docs/blob/master/README.md Run this command to start a local web server for development. ```bash make start ``` -------------------------------- ### Install Tool with curl-bash Source: https://github.com/cloudposse/docs/blob/master/docs/resources/glossary/curl-bash.mdx Use this pattern to download and execute an installation script from a URL. The `-sSL` flags ensure silent, location-transparent transfer. ```bash curl -sSL https://get.rvm.io | bash ``` -------------------------------- ### Example App Environment Configuration Source: https://github.com/cloudposse/docs/blob/master/docs/layers/software-delivery/ecs-ecspresso/setup.mdx Configures the Example App to use a specific repository for environment information and defines the path and reference for the ECSPresso configuration file. This ensures the Example App uses the correct deployment settings. ```yaml ## file: .github/configs/environment.yaml # assumes the same organization environment-info-repo: infrastructure implementation_path: .github/environments implementation_file: ecspresso.yaml implementation_ref: main ``` -------------------------------- ### Deploy ECR Repositories with Atmos Source: https://github.com/cloudposse/docs/blob/master/docs/layers/containers/prerequisite.mdx Use the `atmos` CLI to deploy ECR repositories. This command is typically used in a quickstart or foundation setup. ```bash atmos workflow deploy/ecr -f quickstart/foundation/accounts ``` -------------------------------- ### Install Docker and Build Tools on Ubuntu Source: https://github.com/cloudposse/docs/blob/master/docs/learn/prerequisites.mdx Install essential tools like `curl` and `build-essential` on an Ubuntu environment within WSL. This is part of the setup for running Geodesic on Windows. ```shell apt-get install curl build-essential ``` -------------------------------- ### Install Local Dependencies with Brewfile Source: https://github.com/cloudposse/docs/blob/master/docs/learn/prerequisites.mdx Use `brew bundle install` to install dependencies defined in a Brewfile. Ensure Homebrew is installed first. ```shell brew "atmos" brew "coreutils" brew "pre-commit" brew "terraform-docs" brew "opentofu" brew "tflint" ``` -------------------------------- ### Deploy Example ECS Services Source: https://github.com/cloudposse/docs/blob/master/docs/layers/software-delivery/ecs-ecspresso/setup.mdx Use the Atmos workflow command to deploy the example application on ECS. This command specifies the workflow and the environment configuration file to use. ```bash atmos workflow deploy/app-on-ecs -f quickstart/app/app-on-ecs ``` -------------------------------- ### Install microplane Binary Source: https://github.com/cloudposse/docs/blob/master/docs/community/contribute/contributor-tips.mdx Installs the microplane binary to your system's PATH and makes it executable. Ensure the download path and binary name match the version you obtained. ```bash mv ~/Downloads/mp-0.0.21-darwin-amd64 /usr/local/bin/mp && chmod 755 /usr/local/bin/mp ``` -------------------------------- ### Vendor Grafana Components Source: https://github.com/cloudposse/docs/blob/master/docs/layers/monitoring/grafana/setup.mdx Vendor all required components for Grafana setup. This is the initial step in the setup process. ```bash atmos workflow vendor -f quickstart/monitor/grafana ``` -------------------------------- ### Simplest Label Generation Example Source: https://github.com/cloudposse/docs/blob/master/docs/resources/adrs/proposed/proposed-use-more-flexible-resource-labels.mdx The most basic example demonstrating the use of the `label` module without `label_generator`, relying on top-level `values` and `format` for label construction. ```terraform # Simplest example module "this" { source = "cloudposse/label/null" label_order = [ "org", "ou", "reg", "env", "component"] format = local.default_format values = { org = "cplive", ou = "plat", reg = "ue1" } } ``` -------------------------------- ### Install kubectl on Ubuntu Source: https://github.com/cloudposse/docs/blob/master/docs/learn/maintenance/upgrades/how-to-upgrade-eks.mdx Use this command to install a specific kubectl version on Ubuntu systems. Ensure the version is compatible with your cluster's Kubernetes version. ```bash apt-get install -y kubectl-1.13 ``` ```bash apt-get install -y kubectl-1.14 ``` ```bash apt-get install -y kubectl-1.15 ``` ```bash apt-get install -y kubectl-1.16 ``` ```bash apt-get install -y kubectl-1.17 ``` ```bash apt-get install -y kubectl-1.18 ``` ```bash apt-get install -y kubectl-1.19 ``` ```bash apt-get install -y kubectl-1.20 ``` ```bash apt-get install -y kubectl-1.21 ``` -------------------------------- ### PAT Naming Convention Examples Source: https://github.com/cloudposse/docs/blob/master/docs/layers/software-delivery/eks-argocd/tutorials/pats.mdx Examples of recommended PAT naming conventions for various use cases, adhering to alphanumeric and underscore constraints for classic PATs. ```console # 1. Terraform access for argocd-repo. Requires access to apply both prod and nonprod argocd/terraform/argocd-repo # needs read on org members, write admin and code on both argocd repos # 2. Terraform access for eks/argocd webhooks argocd/terraform-webhooks/nonprod # needs permission to write repository hooks on argocd-deploy-nonprod argocd/terraform-webhooks/prod # needs permission to write repository hooks on argocd-deploy-prod # 3. ArgoCD access for app in cluster ARGOCD_APP_NOTIFICATIONS # needs permission to write commit statuses on any application repo # 4. GitHub Workflow access argocd/github/nonprod # needs write access to argocd-deploy-nonprod and read for infra argocd/github/prod # needs write access to argocd-deploy-prod and read for infra ``` -------------------------------- ### Example .gitignore File Source: https://github.com/cloudposse/docs/blob/master/docs/best-practices/github/github.mdx Use a `.gitignore` file in the root of every repo to exclude files that should never be committed. This example lists common files and directories to ignore. ```txt .DS_Store .envrc .env deploy.toml deploy.yaml test test.toml test.yaml .htmltest.*.yaml node_modules .build-harness build-harness/ public/* algolia/* tmp/* .gitkeep *.swp .idea *.iml package-lock.json static/components/* static/styleguide/* themes/cloudposse/static/css/* themes/cloudposse/static/js/* static/webfonts/* static/css/* static/js/* ``` -------------------------------- ### Quick Install Geodesic Source: https://github.com/cloudposse/docs/blob/master/docs/layers/project/tutorials/geodesic-getting-started.mdx Installs the Geodesic wrapper script without using 'make'. This example pins the script to use the 'cloudposse/geodesic:latest-debian' Docker image. ```bash docker run --rm cloudposse/geodesic:latest-debian init | bash ``` -------------------------------- ### Download Tutorial Project Source: https://github.com/cloudposse/docs/blob/master/docs/layers/project/tutorials/geodesic-getting-started.mdx Navigate to the /localhost directory within Geodesic, clone the tutorials repository, and change into the specific tutorial directory. This makes the project available both in the container and on your local machine. ```bash # Change to our /localhost directory so that we can pull our project's code to our # local machine as well as our docker container cd /localhost # Clone our tutorials repository git clone https://github.com/cloudposse/tutorials # Change to our tutorial code cd tutorials/01-geodesic ``` -------------------------------- ### Start Geodesic Container Source: https://github.com/cloudposse/docs/blob/master/docs/layers/project/toolbox.mdx After building the toolbox image, you can start the Geodesic container for a specific namespace by simply entering the namespace alias. This is configured in the 'install' step of the Makefile. ```bash acme ``` -------------------------------- ### Run Initial Component Tests Source: https://github.com/cloudposse/docs/blob/master/docs/community/contribute/component-testing.mdx Navigate to the 'test' directory and execute this command to run initial tests. The '--only-deploy-dependencies' flag ensures that only necessary dependencies are deployed. ```console cd test go test -v -timeout 1h --only-deploy-dependencies ``` -------------------------------- ### Application IAM Role Example Source: https://github.com/cloudposse/docs/blob/master/docs/layers/software-delivery/ecs-atmos/setup.mdx Example of an IAM role definition for an application within the ECS setup. This role grants necessary permissions for the application to interact with AWS services. ```yaml apiVersion: iam.aws.upbound.io/v1beta1 kind: Role metadata: name: example-app spec: forProvider: assumeRolePolicy: | { "Version": "2012-10-17", "Statement": [ { "Action": "sts:AssumeRole", "Effect": "Allow", "Principal": { "Service": "ecs-tasks.amazonaws.com" } } ] } providerConfigRef: name: aws-providerconfig ``` -------------------------------- ### Configuration Example Source: https://github.com/cloudposse/docs/blob/master/docs/resources/adrs/proposed/proposed-use-atmos-registry.mdx This snippet demonstrates how to define component configurations, including Terraform and Helmfile components, with their respective versions and variables. ```yaml import: - uw2-globals vars: stage: testplatform terraform: vars: {} helmfile: vars: account_number: "199589633144" components: terraform: # this will download all components into `aws-component/0.141.0` # it's abstract because: atmos terraform apply aws-component doesn't make sense "cloudposse/terarform-aws-components/0.141.0": metadata: type: abstract source: https://github.com/cloudposse/terraform-aws-components//modules version: 0.141.0 # this will run aurora-postgres from `aws-component/0.141.0/aurora-postgres` aurora-postgres: component: "cloudposse/terraform-aws-components/0.141.0/aurora-postgres" mixins: # calling this mixins is confusing # this will upgrade the context.tf - file: context.tf source: https://github.com/cloudposse/terraform-aws-components/mixins/context.tf version: 1.2.3 vars: # https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Concepts.DBInstanceClass.html instance_type: db.r4.large cluster_size: 1 cluster_name: main database_name: main # this will run aurora-postgres from `aws-component/0.141.0/aurora-postgres` eks: component: "eks" mixins: metadata: type: real source: https://github.com/gruntwork/terraform-aws-components//modules/eks version: 1.0 vars: # https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Concepts.DBInstanceClass.html instance_type: db.r4.large cluster_size: 1 cluster_name: main database_name: main helmfile: cert-manager: metadata: type: real source: https://github.com/cloudposse/helmfiles/cert-manager/ version: 1.0 vars: .. ``` -------------------------------- ### Launch Geodesic Environment Source: https://github.com/cloudposse/docs/blob/master/docs/layers/identity/how-to-log-into-aws.mdx Execute this command for subsequent launches of the Geodesic environment after the initial setup is complete. This command starts the pre-configured containerized workflow. ```bash make run ``` -------------------------------- ### Tear Down Output Source: https://github.com/cloudposse/docs/blob/master/docs/community/contribute/component-testing.mdx Console output indicating the start of the test run and setup process for tearing down the test environment. This output shows the initial steps of the test execution. ```console === RUN TestRunSuite 2025/03/07 14:13:34 INFO TestRunSuite: setup → started 2025/03/07 14:13:34 INFO TestRunSuite: tests will be run in temp directory path=/var/folders/1l/hcm6nfms6g58mdrpwcxklsvh0000gn/T/atmos-test-helper3047340212 2025/03/07 14:13:34 INFO TestRunSuite: terraform state for tests will be saved in state directory path=/var/folders/1l/hcm6nfms6g58mdrpwcxklsvh0000gn/T/atmos-test-helper3047340212/state 2025/03/07 14:13:34 INFO TestRunSuite: setup/bootstrap temp dir → completed ``` -------------------------------- ### Run Init Workflow Source: https://github.com/cloudposse/docs/blob/master/examples/snippets/stacks/workflows/README.md Use `init` to execute any commands required before deployment. Specify the workflow filename with `-f`. ```bash atmos workflow init -f baseline ``` -------------------------------- ### Component Test Setup Source: https://github.com/cloudposse/docs/blob/master/docs/community/contribute/component-testing.mdx Go code for setting up a component test suite, including necessary imports and the test suite structure. ```go package test import ( "testing" helper "github.com/cloudposse/test-helpers/pkg/atmos/component-helper" ) ``` -------------------------------- ### Example Directory Structure for Atmos Source: https://github.com/cloudposse/docs/blob/master/docs/learn/maintenance/tutorials/how-to-use-atmos-with-existing-terraform.mdx Illustrates the recommended folder organization for components and stacks when using Atmos with Terraform. ```bash infrastructure/ ├── ... ├── components/ │ ├── terraform/ │ │ ├── ec2-instance/ │ │ └── vpc/ └── stacks/ ``` -------------------------------- ### Install Python Requirements Source: https://github.com/cloudposse/docs/blob/master/scripts/README.md Installs the necessary Python packages for the docs-collator tool. ```bash pip install -r scripts/docs-collator/requirements.txt ``` -------------------------------- ### Install cloud-nuke Source: https://github.com/cloudposse/docs/blob/master/docs/layers/accounts/tutorials/how-to-delete-aws-accounts.mdx Use Homebrew to install the cloud-nuke utility for cleaning AWS resources. ```bash brew install cloud-nuke ``` -------------------------------- ### Example EC2 Instance Component Configuration Source: https://github.com/cloudposse/docs/blob/master/docs/learn/maintenance/tutorials/how-to-use-atmos-with-existing-terraform.mdx Shows a sample configuration for an 'ec2-instance' component, including backend settings and default variables. ```yaml components: terraform: ec2-instance: backend: s3: workspace_key_prefix: ec2-instance vars: enabled: true ``` -------------------------------- ### Configure Account Defaults Source: https://github.com/cloudposse/docs/blob/master/docs/layers/accounts/tutorials/how-to-create-and-setup-aws-accounts.mdx Set up the `_defaults.yaml` file (e.g., `stacks/orgs/acme/core/foobar/_defaults.yaml`) to establish common settings and import necessary configurations for all subsequent files in the account's stack. ```yaml import: - orgs/acme/core/_defaults - mixins/stage/foobar ``` -------------------------------- ### Build Dependencies with Make Source: https://github.com/cloudposse/docs/blob/master/README.md Run this command to build all project dependencies. ```bash make all ``` -------------------------------- ### Start Authenticated Atmos Session Source: https://github.com/cloudposse/docs/blob/master/docs/layers/accounts/prepare-aws-organization.mdx Start an authenticated session with Atmos. You will be prompted to enter a one-time MFA token. ```bash atmos auth login -i core-root/terraform ``` -------------------------------- ### Initialize Terraform State Backend Source: https://github.com/cloudposse/docs/blob/master/docs/layers/accounts/initialize-tfstate.mdx Run this command to initialize the Terraform State Backend. It first creates the backend using a local Terraform state, then migrates the state file to the newly created S3 bucket. ```bash atmos workflow init/tfstate quickstart/foundation/accounts ``` -------------------------------- ### Install Geodesic Locally Source: https://github.com/cloudposse/docs/blob/master/docs/layers/project/tutorials/geodesic-getting-started.mdx Installs Geodesic onto your local machine using the provided Makefile. Ensure you have the Makefile in your repository. ```bash make install ``` -------------------------------- ### Verify Docker Installation Source: https://github.com/cloudposse/docs/blob/master/docs/learn/maintenance/tutorials/how-to-run-docker-in-docker-with-geodesic.mdx Check if Docker is installed and running correctly by listing the currently running Docker containers. This confirms that Docker is operational. ```bash docker ps ``` -------------------------------- ### Version 2 File Structure Example Source: https://github.com/cloudposse/docs/blob/master/docs/resources/version-identification.mdx This shows a typical file structure for Version 2, emphasizing the `profiles` directory for Atmos Auth and the `iam-role` component. ```text profiles/ ├── superadmin/ ├── managers/ ├── devops/ ├── developers/ └── github/ components/terraform/ └── iam-role/ stacks/catalog/ └── iam-role/ ├── terraform.yaml ├── planner.yaml └── gitops.yaml ``` -------------------------------- ### Install Docker on Debian Source: https://github.com/cloudposse/docs/blob/master/docs/learn/maintenance/tutorials/how-to-run-docker-in-docker-with-geodesic.mdx Install the Docker package on a Debian-based system within the Geodesic environment. This command ensures Docker is available for use. ```bash apt-get -y install docker.io ``` -------------------------------- ### Version 1 File Structure Example Source: https://github.com/cloudposse/docs/blob/master/docs/resources/version-identification.mdx This illustrates a typical file structure for Version 1, highlighting the presence of `account-map`, `aws-teams`, and `aws-team-roles` components. ```text components/terraform/ ├── account-map/ ├── aws-teams/ ├── aws-team-roles/ └── github-oidc-role/ stacks/catalog/ ├── account-map/ ├── aws-teams/ └── aws-team-roles/ ``` -------------------------------- ### Helm Mixin Configuration Example Source: https://github.com/cloudposse/docs/blob/master/docs/resources/adrs/proposed/proposed-use-mixins-to-dry-up-components.mdx This configuration block is an example of how to define parameters for a Helm chart within a Terraform component using the helm.mixin.tf. ```hcl name = "alb-controller" chart = "aws-load-balancer-controller" chart_repository = "https://aws.github.io/eks-charts" chart_version = "1.4.0" kubernetes_namespace = "kube-system" resources = { limits = { cpu = "200m" memory = "256Mi" }, requests = { cpu = "100m" memory = "128Mi" } } ``` -------------------------------- ### Example Atmos command for deploying account settings Source: https://github.com/cloudposse/docs/blob/master/docs/layers/accounts/faq.mdx This is an example of an Atmos command that might fail due to duplicate component configurations across different stack files. Ensure context variables and imports are correctly defined and unique. ```bash Executing command: /usr/bin/atmos terraform deploy account-settings -s core-gbl-artifacts Found duplicate config for the component 'account-settings' for the stack 'core-gbl-artifacts' in the files: orgs/cch/core/artifacts/global-region/baseline, orgs/cch/core/artifacts/global-region/monitoring, orgs/cch/core/artifacts/global-region/identity. Check that all context variables in the stack name pattern '{tenant}-{environment}-{stage}' are correctly defined in the files and not duplicated. Check that all imports are valid. exit status 1 ``` -------------------------------- ### Deploy All Data Components Source: https://github.com/cloudposse/docs/blob/master/docs/layers/data/setup.mdx Use this command to deploy all data components, including clusters and resources, for your application. Ensure you are connected to the VPN before deploying resources. ```bash atmos workflow deploy/all -f quickstart/app/data ``` -------------------------------- ### Install pre-commit for Git Hooks Source: https://github.com/cloudposse/docs/blob/master/docs/learn/tips-and-tricks/terraform.mdx Install the pre-commit utility on macOS using Homebrew. This tool helps manage and automate Git pre-commit hooks. ```shell brew install pre-commit ``` -------------------------------- ### Atmos Configuration with Registries Source: https://github.com/cloudposse/docs/blob/master/docs/resources/adrs/proposed/proposed-use-atmos-registry.mdx Example `atmos.yml` configuration showing how to specify component and stack registries. ```yaml components: terraform: registries: - cloudposse/terraform-aws-components stacks: registries: - cloudposse/refarch ``` -------------------------------- ### Run Component Tests Source: https://github.com/cloudposse/docs/blob/master/docs/community/contribute/component-testing.mdx This output shows the logs from a component test run, including setup, dependency vendoring, and deployment stages. It concludes with test results. ```go 2025/03/07 14:13:34 INFO TestRunSuite: setup/copy component to temp dir → started 2025/03/07 14:13:34 INFO TestRunSuite: setup/copy component to temp dir → completed 2025/03/07 14:13:34 INFO TestRunSuite: vendor dependencies → started TestRunSuite 2025-03-07T14:13:35+01:00 retry.go:91: atmos [vendor pull] TestRunSuite 2025-03-07T14:13:35+01:00 logger.go:67: Running command atmos with args [vendor pull] TestRunSuite 2025-03-07T14:13:35+01:00 logger.go:67: Processing vendor config file 'vendor.yaml' TestRunSuite 2025-03-07T14:13:35+01:00 logger.go:67: Pulling sources for the component 'account-map' from 'github.com/cloudposse/terraform-aws-components.git//modules/account-map?ref=1.520.0' into 'components/terraform/account-map' 2025/03/07 14:13:42 INFO TestRunSuite: vendor dependencies → completed 2025/03/07 17:38:24 INFO TestRunSuite: deploy dependencies → completed 2025/03/07 17:43:27 INFO TestRunSuite: setup → completed ... 2025/03/07 17:43:27 WARN TestRunSuite: teardown → completed --- PASS: TestRunSuite (322.74s) --- PASS: TestRunSuite/TestBasic (3.19s) --- PASS: TestRunSuite/TestEnabledFlag (1.02s) PASS ok test 324.052s ``` -------------------------------- ### Install gum CLI Tool Source: https://github.com/cloudposse/docs/blob/master/docs/layers/data/tutorials/how-to-migrate-rds-snapshots.mdx Add the following lines to your infrastructure Dockerfile to install the 'gum' CLI tool, which enhances bash scripts with interactive elements. ```dockerfile # Install gum - a CLI tool for making bash scripts "pretty" # https://github.com/charmbracelet/gum RUN mkdir -p /etc/apt/keyrings RUN curl -fsSL https://repo.charm.sh/apt/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/charm.gpg RUN echo "deb [signed-by=/etc/apt/keyrings/charm.gpg] https://repo.charm.sh/apt/ * *" | sudo tee /etc/apt/sources.list.d/charm.list RUN apt-get update && apt-get install -y --allow-downgrades \ gum ``` -------------------------------- ### Implement a Help Target Source: https://github.com/cloudposse/docs/blob/master/docs/best-practices/developer/makefile.mdx Include a 'help' target that automatically generates a list of available targets and their descriptions. This improves discoverability and usability. ```makefile ## This help screen help: @printf "Available targets:\n\n" @awk '/^[a-zA-Z\-_0-9%:\\]+/ { \ helpMessage = match(lastLine, /^## (.*)/); \ if (helpMessage) { \ helpCommand = $$1; \ helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ gsub("\\", "", helpCommand); \ gsub(":+$$", "", helpCommand); \ printf " \x1b[32;01m%-35s\x1b[0m %s\n", helpCommand, helpMessage; \ } \ } \ { lastLine = $$0 }' $(MAKEFILE_LIST) | sort -u @printf "\n" ``` -------------------------------- ### Golang Component Test Structure Source: https://github.com/cloudposse/docs/blob/master/docs/community/contribute/component-testing.mdx This Go code demonstrates the structure of a component test suite using the test-helpers library. It includes setup for dependencies, running the test suite, and defining individual test cases for deployment, verification, and cleanup. ```go package test import ( "context" "testing" "fmt" "strings" helper "github.com/cloudposse/test-helpers/pkg/atmos/component-helper" awsHelper "github.com/cloudposse/test-helpers/pkg/aws" "github.com/cloudposse/test-helpers/pkg/atmos" "github.com/gruntwork-io/terratest/modules/aws" "github.com/stretchr/testify/assert" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) type ComponentSuite struct { helper.TestSuite } // Functions Test prefix are entrypoint for `go test` func TestRunSuite(t *testing.T) { # Define test suite instance suite := new(ComponentSuite) // Add dependency to the dependencies queue ssuite.AddDependency(t, "vpc", "default-test", nil) // Run test suite helper.Run(t, suite) } // Test suite methods prefixed with `Test` are tests // Test basic usecase func (s *ComponentSuite) TestBasic() { const component = "example/basic" const stack = "default-test" const awsRegion = "us-east-2" // Destroy test component defer s.DestroyAtmosComponent(s.T(), component, stack, nil) // Deploy test component options, _ := s.DeployAtmosComponent(s.T(), component, stack, nil) assert.NotNil(s.T(), options) // Get test component output id := atmos.Output(s.T(), options, "eks_cluster_id") assert.True(s.T(), strings.HasPrefix(id, "eg-default-ue2-test-")) // Test component drift s.DriftTest(component, stack, nil) } // Test disabled use case func (s *ComponentSuite) TestEnabledFlag() { const component = "example/disabled" const stack = "default-test" // Verify no resources created when `enabled: false` s.VerifyEnabledFlag(component, stack, nil) } ``` -------------------------------- ### Get RDS Component Output Source: https://github.com/cloudposse/docs/blob/master/docs/layers/data/tutorials/how-to-migrate-rds-snapshots.mdx Retrieve the RDS component output, which includes connection details for the RDS instance. This is typically used to get the hostname and port. ```bash atmos terraform output rds -s plat-usw2-prod ``` -------------------------------- ### Install kubectl on Alpine Source: https://github.com/cloudposse/docs/blob/master/docs/learn/maintenance/upgrades/how-to-upgrade-eks.mdx Use this command to install a specific kubectl version on Alpine Linux systems. Ensure the version is compatible with your cluster's Kubernetes version. ```bash apk add kubectl-1.13@cloudposse ``` ```bash apk add kubectl-1.14@cloudposse ``` ```bash apk add kubectl-1.15@cloudposse ``` ```bash apk add kubectl-1.16@cloudposse ``` ```bash apk add kubectl-1.17@cloudposse ``` ```bash apk add kubectl-1.18@cloudposse ``` ```bash apk add kubectl-1.19@cloudposse ``` ```bash apk add kubectl-1.20@cloudposse ``` ```bash apk add kubectl-1.21@cloudposse ``` -------------------------------- ### Display Welcome and Configuration Messages Source: https://github.com/cloudposse/docs/blob/master/docs/layers/data/tutorials/how-to-migrate-rds-snapshots.mdx Uses `gum style` and `gum log` to display welcome messages and configuration details for the RDS migration process. It prompts the user for confirmation before proceeding. ```bash start_time=$(date +%s) gum_log "Database migration started..." gum style \ --foreground 212 --border-foreground 212 --border double \ --align center --width 50 --margin "1 2" --padding "2 4" \ "Welcome to the RDS Snapshot Migration helper!" gum style \ --foreground 31 \ --margin "1 2" \ "Legacy RDS Instance: ${legacy_rds_instance_id}" \ "..." \ "Legacy Account ID: ${legacy_account_id}" \ "Legacy Account Profile: ${legacy_profile}" \ "Legacy Account Region: ${legacy_region}" \ "..." \ "Destination Account ID: ${acme_account_id}" \ "Destination Account Profile: ${acme_profile}" \ "Destination Account Region: ${acme_region}" printf "Are you ready to start the datastore migration using these values?\n" response=$(gum choose "yes" "no") if [[ "$response" != "yes" ]]; then gum log --time rfc822 --structured --level debug "Exiting..." exit 0 fi ```