Skip to content
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

terraform shell should drop you into the correct working directory #556

Closed
Nuru opened this issue Mar 6, 2024 · 2 comments
Closed

terraform shell should drop you into the correct working directory #556

Nuru opened this issue Mar 6, 2024 · 2 comments
Labels
bug 🐛 An issue with the system invalid This doesn't seem right

Comments

@Nuru
Copy link
Sponsor Contributor

Nuru commented Mar 6, 2024

Describe the Bug

The command atmos terraform shell launches a shell in the component base directory, not the directory of the selected component, but terraform commands only work when the current directory is the directory of the component.

Expected Behavior

atmos terraform shell <component> should launch a shell in the directory of the component, specifically .component_info.terraform_config.path as determined by atmos describe component <component>.

Steps to Reproduce

Run atmos terraform shell <component> -s <stack> for any valid stack and component, and note that your current working directory is Atmos-configured components.terraform.base_path and not the component's Terraform directory

Screenshots

No response

Environment

  • Atmos v1.63.0
  • Geodesic 2.9.1-debian

Additional Context

The premise of atmos terraform shell is that it prepares you to use unadorned Terraform commands at the command line that operate on the designated component with the designated stack configuration. Without being in the proper working directory, terraform does not work and the premise is not fulfilled.

@Nuru Nuru added the bug 🐛 An issue with the system label Mar 6, 2024
@kevcube
Copy link
Contributor

kevcube commented Mar 21, 2024

@Nuru this is not the behavior I experience, I DO get dropped into the component's directory, not my parent directory of all components.

config:

# See full configuration options @ https://github.com/cloudposse/atmos/blob/master/examples/complete/atmos.yaml

base_path: ""

components:
  terraform:
    base_path: "components"
    auto_generate_backend_file: true

stacks:
  base_path: "stacks"
  included_paths:
    - "org/**/*"
  name_pattern: "{stage}"
  excluded_paths:
    - "**/_*.yaml" # Do not consider any file beginning with "_" as a stack file

logs:
  verbose: true
  colors: true

commands:
  - name: up
    description: Run terraform `init -upgrade` for a given component instance
    arguments:
      - name: component
        description: Name of the component
    flags:
      - name: stack
        shorthand: s
        description: Name of the stack
        required: true
    steps:
      - atmos terraform init {{ .Arguments.component }} -s {{ .Flags.stack }} -upgrade

@Nuru Nuru added the invalid This doesn't seem right label Mar 30, 2024
@Nuru
Copy link
Sponsor Contributor Author

Nuru commented Mar 30, 2024

My apologies. This was caused by a customization I have configured.

@Nuru Nuru closed this as completed Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants