cloudposse / cloudposse/atmos

Vendored artefacts are targeted relative to the vendor.yaml file, not the base_path specified in atmos.yaml

Open
#2,409 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
1.4k
Forks
175
Avg merge
2d 3h
Merged PRs (30d)
134

Description

### Describe the Bug

Hi. I have a use case where it's desirable to have Atmos.yaml and vendor.yaml tucked away out of the main repository root.

I find that when I `atmos vendor pull` I can only seem to target relative to vendor.yaml's location, i.e:

Running `atmos vendor pull` puts the `components/terraform` directory adjacent to the vendor.yaml.

### Expected Behavior

I would have strongly thought it wants to be relative to the atmos.yaml's `base_path`, otherwise, I don't understand the intent.

### Steps to Reproduce

path/to/atmos.yaml
```
base_path: !repo-root

vendor:
base_path: path/to/vendor.yaml

components:
terraform:
base_path: components/terraform
apply_auto_approve: false
deploy_run_init: true
init_run_reconfigure: true
auto_generate_backend_file: true

stacks:
base_path: stacks
included_paths:
- "**/*"
excluded_paths:
- "**/_defaults.yaml"
name_pattern: "{stage}"

logs:
file: /dev/stderr
level: Info

settings:
list_merge_strategy: replace
```

path/to/vendor.yaml
```
apiVersion: atmos/v1
kind: AtmosVendorConfig
metadata:
name: vendored
description: vendoring
spec:
sources:
- component: "github/stargazers"
source: "github.com/cloudposse/atmos.git//examples/demo-library/{{ .Component }}?ref={{.Version}}"
version: "main"
targets:
- "components/terraform/{{ .Component }}/{{.Version}}"
included_paths:
- "**/*.tf"
- "**/*.tfvars"
- "**/*.md"
tags:
- demo
- github
```

`ATMOS_CLI_CONFIG_PATH=path/to/ atmos vendor pull` pulls the component to `path/to/...` not `!repo_root`

### Screenshots

_No response_

### Environment

_No response_

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the `atmos vendor pull` command and how it loads `path/to/atmos.yaml` and `path/to/vendor.yaml` when `ATMOS_CLI_CONFIG_PATH=path/to/` is set. Reproduce the vendoring scenario, then verify that targets such as `components/terraform/{{ .Component }}/{{.Version}}` resolve relative to the configured `base_path`; done means the component is pulled under the repository root rather than beside `vendor.yaml`.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.