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

.json files support ? #243

Open
Pardeep009 opened this issue Aug 24, 2022 · 3 comments
Open

.json files support ? #243

Pardeep009 opened this issue Aug 24, 2022 · 3 comments

Comments

@Pardeep009
Copy link

Pardeep009 commented Aug 24, 2022

is the file whose name ends with .json supported by this tool to generate atlantis.yaml?
context: we are submitting a file_name.json to Atlantis, befor plan and apply runs, we are running a pre-workflow hook terragrunt-atlantis-config_1.14.2_linux_amd64 generate --output atlantis.yaml --parallel=false --autoplan --automerge --ignore-dependency-blocks=true which is generating atlantis.yaml file but for file_name.json it didn't made any entry in atlantis.yaml and because of that no plan ran for that file.

captured server logs when we push such file

Aug 24 19:33:00 <atlantis-vm> atlantis[93604]: {"level":"info","ts":"2022-08-24T19:33:00.480Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:33:01 <atlantis-vm> atlantis[93604]: {"level":"info","ts":"2022-08-24T19:33:01.532Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:33:03 <atlantis-vm> atlantis[93604]: {"level":"info","ts":"2022-08-24T19:33:03.541Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:33:05 <atlantis-vm> atlantis[93604]: {"level":"info","ts":"2022-08-24T19:33:05.479Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:33:06 <atlantis-vm> atlantis[93604]: {"level":"info","ts":"2022-08-24T19:33:06.532Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:33:08 <atlantis-vm> atlantis[93604]: {"level":"info","ts":"2022-08-24T19:33:08.413Z","caller":"events/events_controller.go:461","msg":"identified event as type \"updated\"","json":{}}
Aug 24 19:33:08 <atlantis-vm> atlantis[93604]: {"level":"info","ts":"2022-08-24T19:33:08.413Z","caller":"events/events_controller.go:346","msg":"executing autoplan","json":{}}
Aug 24 19:33:08 <atlantis-vm> atlantis[93604]: {"level":"info","ts":"2022-08-24T19:33:08.541Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:33:08 <atlantis-vm> atlantis[93604]: {"level":"info","ts":"2022-08-24T19:33:08.930Z","caller":"events/working_dir.go:202","msg":"creating dir \"/opt/atlantis/.atlantis/repos/skynet/skynet/<XXX>/default\"","json":{"repo":"skynet/skynet","pull":"XXX"}}
Aug 24 19:33:10 <atlantis-vm> atlantis[93604]: {"level":"info","ts":"2022-08-24T19:33:10.479Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:33:11 <atlantis-vm> atlantis[93604]: {"level":"info","ts":"2022-08-24T19:33:11.532Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:33:13 <atlantis-vm> atlantis[93604]: {"level":"info","ts":"2022-08-24T19:33:13.541Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:33:14 <atlantis-vm> atlantis[93604]: {"level":"info","ts":"2022-08-24T19:33:14.962Z","caller":"runtime/pre_workflow_hook_runner.go:50","msg":"successfully ran \"terragrunt-atlantis-config_1.14.2_linux_amd64 generate --output atlantis.yaml  --parallel=false --autoplan --automerge --ignore-dependency-blocks=true\" in \"/opt/atlantis/.atlantis/repos/skynet/skynet/XXX/default\"","json":{"repo":"skynet/skynet","pull":"XXX"}}
Aug 24 19:33:15 <atlantis-vm> atlantis[93604]: {"level":"info","ts":"2022-08-24T19:33:15.152Z","caller":"events/project_command_builder.go:238","msg":"successfully parsed atlantis.yaml file","json":{"repo":"skynet/skynet","pull":"XXX"}}
Aug 24 19:33:15 <atlantis-vm> atlantis[93604]: {"level":"info","ts":"2022-08-24T19:33:15.199Z","caller":"events/project_command_builder.go:243","msg":"0 projects are to be planned based on their when_modified config","json":{"repo":"skynet/skynet","pull":"XXX"}}
Aug 24 19:33:15 <atlantis-vm> atlantis[93604]: {"level":"info","ts":"2022-08-24T19:33:15.199Z","caller":"events/plan_command_runner.go:84","msg":"determined there was no project to run plan in","json":{"repo":"skynet/skynet","pull":"XXX"}}
Aug 24 19:33:15 <atlantis-vm> atlantis[93604]: {"level":"info","ts":"2022-08-24T19:33:15.479Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:33:16 <atlantis-vm> atlantis[93604]: {"level":"info","ts":"2022-08-24T19:33:16.532Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:33:18 <atlantis-vm> atlantis[93604]: {"level":"info","ts":"2022-08-24T19:33:18.545Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:33:20 <atlantis-vm> atlantis[93604]: {"level":"info","ts":"2022-08-24T19:33:20.479Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
Aug 24 19:33:21 <atlantis-vm> atlantis[93604]: {"level":"info","ts":"2022-08-24T19:33:21.532Z","caller":"server/server.go:864","msg":"Apply Lock: {false 0001-01-01 00:00:00 +0000 UTC }","json":{}}
@Almenon
Copy link
Collaborator

Almenon commented Jan 20, 2024

Support for custom files in general, not just json, would be great. Technically you can do this with extra_atlantis_dependencies, but it takes a lot of configuration. In every single terragrunt.hcl you would have to have a extra_atlantis_dependencies with ../../modules/<modulename>/*.json, *.yml, etc. Repeat for all the module dependencies. Something like the below for every terragrunt.hcl

locals {
  module_source = "../../../modules/atlantis"
  dependency1_source = "${get_terragrunt_dir()}/../dependency1"
  dependency2_source = "${get_terragrunt_dir()}/../dependency2"
  extra_atlantis_dependencies = [
    "${local.module_source}/*.json",
    "${local.module_source}/*.yaml",
    "${local.module_source}/*.etc",
  ]
}

Another hacky workaround would be to name your <customfiletype> files .tf.<customfiletype>, like .tf.json or .tf.yaml. This is simple but you run the risk of people forgetting to do this.

But it would be a lot easier and cleaner to just pass in a flag --file-endings='*.tf*,*.hcl,*.yaml,*.json'.

@Almenon
Copy link
Collaborator

Almenon commented Jan 20, 2024

Another hacky workaround would be to name your files .tf., like .tf.json or .tf.yaml. This is simple but you run the risk of people forgetting to do this.

Actually, that doesn't work because then terraform thinks those are actual terraform files and you get syntax errors >_<

@Almenon
Copy link
Collaborator

Almenon commented Jan 20, 2024

Another possibility is to go the opposite route and just filter out markdown files. It would be much more inclusive of different files types. It's highly unlikely that someone wants to dynamically read in markdown files into terraform code.

https://www.runatlantis.io/docs/repo-level-atlantis-yaml.html#configuring-planning

https://docs.docker.com/build/building/context/#negating-matches

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants