-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Hi Corbalt team! I have a somewhat of an issue when trying to use your Kion tool: there is no option to set the path of the kion.yml config file. Here is what I mean.
We use Terragrunt, and here is an example of our repository for our IaC:
➜ test git:(main) ✗ tree
.
├── .envrc
├── account.hcl
├── kion.yml
└── us-east-1
├── api
│ ├── 00_api_fargate
│ │ └── terragrunt.hcl
│ └── env.hcl
├── base
│ ├── 00_api_gateway
│ │ └── terragrunt.hcl
│ ├── 00_cms_securityhub_notifications
│ │ └── terragrunt.hcl
│ ├── 00_cmscloud
│ │ └── terragrunt.hcl
...In my kion.yml file is this:
➜ test git:(main) ✗ cat kion.yml
account-id: xxxxxxxxx461
cloud-access-role: mct-application-adminAnd inside my .envrc file is this:
source_up
export AWS_PROFILE=kionSo, if I am inside the test directory and run aws sts get-caller-identity or a Terragrunt command, the Kion tool works as expected.
However, if I go into any of the subdirectories and try to do the same, I get an error since the kion.yml config file isn't in that subdirectory and it can't be found.
I would like to request an option be given to add a KION_CONFIG_PATH environment variable that can be used to find the kion.yml file no matter the location. For example, the go code can be updated like so:
func main() {
var configPaths []string
val, kionConfigPathEnvSet := os.LookupEnv("KION_CONFIG_PATH")
userConfigName, err := config.UserConfigName()
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
if kionConfigPathEnvSet {
configPaths = []string{
userConfigName,
filepath.Join("/", val),
}
} else {
configPaths = []string{
userConfigName,
filepath.Join(".", "kion.yml"),
}
}I'm not a Go expert, so this could likely be improved upon.
Then, inside of my .envrc file I can add a line for the config path:
source_up
export AWS_PROFILE=kion
export KION_CONFIG_PATH=$PWD/kion.ymlNow, no matter which subdirectory I am in under the test directory, the kion.yml file can be found and used. This would help make the tool more flexible. Without this option we would need this kion.yml config file in all of our subdirectories.