#atmos - July 2024

16 messages

👽️

Miguel Zablah
Miguel Zablahover 2 years ago
Hi, we are staring to switch to use Atmos instead of a custom terragrunt config to manage terraform since it resolves a lot of custom stuff we need to do so thanks for this awesome tool I just have 2 questions.

1. When creating the initial S3 backend and DynamoDB do you guys use the tfstate-backend module outside of atmos or create this manually? I was following the advance tutorial and it looks good but I don't see any docs around this although maybe I miss something
2. Is there a global env to get the git commit number so I can set it as a tag?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 2 years ago
@here

🚀 For a limited time, we're offering the complete Cloud Posse reference architecture as a perk for a monthly GitHub Enterprise Sponsorship.

Please feel free to contact me if you'd like to learn more.

This is ideal for savvy teams who want a head start. The feedback we've received is excellent.
Miguel Zablah
Miguel Zablahover 2 years ago
dose atmos has a validation to check version?
Brett L
Brett Lover 2 years ago
Is there some examples of Atmos that are not reference architecture? I'm trying to find if it's a good fit for our use case, which is simply managing Datadog resources
Stephan Helas
Stephan Helasover 2 years ago
Hello,

would it be possible to make the interactive mode optional? like using a parameter to start / env variable to prevent it?
Bradley A. Wangia, Ph.D.
Bradley A. Wangia, Ph.D.over 2 years ago(edited)
ameer
ameerover 2 years ago
how would one go about running a terraform import state under atmos?
something like? atmos terraform "import resource resource-id" component --s stack
(this didn’t work)
Miguel Zablah
Miguel Zablahover 2 years ago(edited)
dose atmos.Component allows for a dependency of list or only strings?

I try to do this:
vpc_cidr_blocks: '{{ (atmos.Component "vpc" .stack).outputs.vpc_private_cidr_blocks }}'

but I get this:
vpc_cidr_blocks: "[10.100.0.0/24 10.100.1.0/24]"

I will like to have this as a normal list not a string:
vpc_cidr_blocks: [10.0.0.0/24, 10.0.1.0/24]
Patrick McDonald
Patrick McDonaldover 2 years ago
Hello,
I'm using atmos.Component in my stack manifest file and I'm trying to fetch a list of subnet IDs. I can't seem to find the correct syntax.

This:
subnet_ids: |
  {{- range (atmos.Component "vpc" .stack).outputs.private_subnet_ids }}
    - {{ . }}
  {{- end }}

produces this in the tfvars.json file:
"subnet_ids": "- subnet-0x8ae0b62b933ab72\n- subnet-08551c9314d89f695\n- subnet-04f5a5e154ec39aa3\n",

This:
subnet_ids:
  '{{- range (atmos.Component "vpc" .stack).outputs.private_subnet_ids }}
    - {{ . }}
  {{- end }}'

produces this in the tfvars.json file:
"subnet_ids": " - subnet-0f8ae0b634933ab72 - subnet-08551c9314d89f695 - subnet-0423a4e154ec39aa3",

And this:
subnet_ids: '{{ (atmos.Component "vpc" .stack).outputs.private_subnet_ids | toJson}}'

produces this in the tfvars.json file:
"subnet_ids": "[\"subnet-0f8ae2362b933ab72\",\"subnet-08551c9314d89f695\",\"subnet-0423a4e154ec39aa3\"]",

Terraform output:
private_subnet_ids = [
  "subnet-0f8a23b62b933ab72",
  "subnet-0855123314d89f695",
  "subnet-04f5a2354ec39aa3",
]

What's the correct way to fetch the list of subnet IDs?
Andrew Chemis
Andrew Chemisover 2 years ago
Hi all - In my atmos.yaml file, where I call the terraform_workspace_pattern, I want to force all values to be lowercase. Is that possible?

terraform:
  metadata:
    terraform_workspace_pattern: "{tenant}-{environment}-{stage}-ws"

Brett L
Brett Lover 2 years ago
Does atmos have features for importing existing resources / moving state?
RickA
RickAover 2 years ago
Using vars in imports with v1.85 🧵
RB
RBover 2 years ago
The atmos opa integration is really nice. I previously wrote a few opa policies on raw terraform code and coupled it with conftest unit tests with coverage. Is there an atmosy way of integrating conftests or unit tests for the atmos opa policies?
Zain Zahran
Zain Zahranover 2 years ago
Hello. Previous behavior for stack imports would fail if a value is missing, now it does not fail and it replaces my missing import values with "<no value>" . I have Go Templating enabled and gomplate disabled in my atmos.yaml. Is this new intended behavior? If so, is the solution to use schemas/opa to ensure stack files have the proper values?
RB
RBover 2 years ago
How to prevent developers from modifying component stack yaml that should not be modified ?

For example, aws-team-roles is a high privilege component where only ops should be able to modify the terraform code and the stack yaml.
Stephan Helas
Stephan Helasover 2 years ago(edited)
Hi,

i try to use the import "-path" function like described here https://atmos.tools/core-concepts/stacks/imports/#imports-schema

problem is, i can't figure out how to use go template to set or not set a variable:

so this will work

import:
  - path: "<some_path>"
    context:
       setttings:
         my_value: null


---
but this will give me the string "<no value>" instead of null, which means the variable is defined, which then makes terraform fail to test for null (nullable = false)


import:
  - path: "<some_path>"
    context:
       setttings:
         my_value: '{{ or .settings.some_value nil}}'

and this won't run - compile error

import:
  - path: "<some_path>"
    context:
       setttings:
         '{{ if .settings.some_value}}'
         my_value: '{{ .settings.some_value }}'
         '{{ else }}'
         my_value: null
         '{{ end }}'