cloudposse / terraform-yaml-stack-config

Terraform module that loads an opinionated 'stack' configuration from local or remote YAML sources. It supports deep-merged variables, settings, ENV variables, backend config, and remote state outputs for Terraform and helmfile components.

Home Page:https://cloudposse.com/accelerate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remote State Module Results in Error Cannot find Atmos File

holmes89 opened this issue · comments

Found a bug? Maybe our Slack Community can help.

Slack Community

Describe the Bug

Given the following module definition:

module "gateway" {
  source  = "cloudposse/stack-config/yaml//modules/remote-state"
  version = "1.3.1"
  stack = "my-stack"
  component   = "infra/gateway"
}

I receive an error that atmos file cannot be found:

│ Error: 
│ 'atmos.yaml' CLI config files not found in any of the searched paths: system dir, home dir, current dir, ENV vars.
│ You can download a sample config and adapt it to your requirements from https://raw.githubusercontent.com/cloudposse/atmos/master/examples/complete/atmos.yaml
│ 
│   with module.gateway.data.utils_component_config.config,
│   on .terraform/modules/gateway/modules/remote-state/main.tf line 1, in data "utils_component_config" "config":
│    1: data "utils_component_config" "config" {

Other components deploy fine within the stack using the same atmos.yaml. I'm using the atmos github action but was having the same issue running in a container.

Expected Behavior

To be able to access output of another component

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create component and deploy
  2. Reference remote state:
module "gateway" {
  source  = "cloudposse/stack-config/yaml//modules/remote-state"
  version = "1.3.1"
  stack = "my-stack"
  component   = "infra/gateway"
}
  1. Apply

Screenshots

image

Environment (please complete the following information):

Anything that will help us triage the bug will help. Here are some ideas:

  • GH actions using 👍
      - name: setup-atmos
        uses: cloudposse/github-action-setup-atmos@v1.0.0

@holmes89 atmos.yaml file must be in a location where the CLI can find it.

Please see the following docs for more info:

https://atmos.tools/quick-start/configure-repository#atmosyaml-cli-config-file-location

https://atmos.tools/core-concepts/components/remote-state

It is picking the file up with the other modules I'm deploying in the same way.

I'm sorry, let me check out the link and see if that helps.

Using the github action would require me to export the current directory as the config file location in order to use the remote state?

To solve this in the action I had to add the following before running atmos:

          export ATMOS_CLI_CONFIG_PATH=$(pwd)
          export ATMOS_BASE_PATH=$(pwd)

Thank you for your help @aknysh

@holmes89 thanks for testing.
The GH action is new and we prob need to update README to describe all these edge cases