I have attempted a basic setup of `!store` functio...
# atmos
d
I have attempted a basic setup of
!store
functionality and am not having luck getting things written to the store for later retrieval. I've tried for a stripped down configuration: 1. in
atmos.yaml
, I have a store defined:
Copy code
stores:
  ssm:
    type: aws-ssm-parameter-store
    options:
      region: us-west-2
2. in my
vpc
component I have defined a hook:
Copy code
components:
  terraform:
    vpc:
      metadata:
        component: vpc
      vars:
        ipv4_primary_cidr_block: "10.0.0.0/16"
        assign_generated_ipv6_cidr_block: false
      hooks:
        store-outputs:
          events:
            - after-terraform-apply
          command: store
          name: ssm
          outputs:
            vpc_cidr_block: .vpc_cidr_block
            vpc_id: .vpc_id
I'm running with AdminstratorAccess, so I have not defined read/write roles. When I
apply
, nothing ends up in Parameter Store. Am I missing another piece to the puzzle?
e
When you say "getting things written to the store," what are you seeing?
Any errors? Have you enabled debug logging?
It should be pretty verbose. If you're not seeing anything being written with debug logs, then there's something with the configuration that's off where the inheritance isn't there. I would run
describe component
to see what the component looks like fully de-merged.
d
Will enable debug logging. I am seeing no regular output pertaining to stores, and am not sure whether to expect any.
e
I agree, that's odd. And if it failed to write, it should log it. My assertion is that it's not configured with the component you're executing—for whatever reason.
d
with debug logging, I see this after the module's output:
Copy code
DEBU processStoreConfig atmosConfig.StoresConfig="map[ssm:{aws-ssm-parameter-store map[region:us-west-2]}]"
DEBU processStoreConfig atmosConfig.StoresConfig="map[ssm:{aws-ssm-parameter-store map[region:us-west-2]}]"
using
atmos describe component
I get this (top level key in the output):
Copy code
hooks:
  store-outputs:
    command: store
    events:
      - after-terraform-apply
    name: ssm
    outputs:
      vpc_cidr_block: .vpc_cidr_block
      vpc_id: .vpc_id
but I see no entries in us-west-2 param store 😞
will noodle some more. I was hoping there would be an obvious thing i'd overlooked
e
I think it's using—so if you haven't explicitly set the IAM role to use, otherwise it's going to be using the IAM role of your current session. So it's just probably not the AWS account you're expecting.
d
yeah, I've considered that. But I don't have a default in my ~/.aws configs and have been running aws CLI and atmos using the same STS tokens. I'll agree it's something up with my config. I just need to figure out how to diagnose. I'll create the roles and see if that resolves it
e
Right, but it's whatever in your current shell context that you are running Atmos in with those AWS credentials, and the account associated with those credentials is where those SSM parameters are—if an explicit role has not been configured in the Atmos configuration for the store.
Copy code
read_role_arn: "arn:aws:iam::123456789012:role/ssm-read-role"  # Optional role ARN for read operations
      write_role_arn: "arn:aws:iam::123456789012:role/ssm-write-role"  # Optional role ARN for write operations
d
Yeah, that is as I figured. My shell context, my .aws/creds and .aws/config all have config and sts tokens from the one account. I've added roles to stores config and now see slightly modified log lines (they now report the roles associated with stores) but still no outputs written. So it's something else with my config. Either I have the stores/hooks stanzas in the wrong spot, or am not specifying what to write correctly 🤷 Anyway, I do appreciate the input.
I've injected a typo in the write-role ARN, expecting that if the write is attempted I'll see this. And no dice. So I'm assuming the hook is misconfigured.
e
Have you tried running
atmos describe component
d
yes. output is pasted here: https://sweetops.slack.com/archives/C031919U8A0/p1759348628378909?thread_ts=1759346340.123199&cid=C031919U8A0 as noted,
hooks
is a top-level key. i'm not sure where
hooks
should fall in the schema, so I'm not sure if that's valid, or if it should be nested lower
am punting for now have created a module to write to SSM. the read side is working fine and this has me out of the woods
though now I'm creating more trouble for myself. I'm setting a secret with a JSON blob and am now trying to figure out how to pass the ARN via SSM, pull it using
!store
and then append
:json-key
to the end. I'm suspecting that i'm asking a lot of the YAML function 😄
e
Ahah, yes, so this is the issue:
Copy code
hooks:
  store-outputs:
    command: store
    events:
      - after-terraform-apply
    name: ssm
    outputs:
      vpc_cidr_block: .vpc_cidr_block
      vpc_id: .vpc_id
If you see this at the top-level, then EVERYTHING will attempt to set these
That means that somewhere in one of your files, you have set it at the TOP of the YAML file.
The scope is not the scope of the file; that might be the misunderstanding
d
Thanks again, @Erik Osterman (Cloud Posse). I appreciate the amount of support you and your team provide between this and the office hours. I can't dive deeper on this now. But I'm happy to try to build test cases and/or contribute some code once this gets boiled down. I'm still fairly sure its a config problem... I just don't have the atmos smarts to debug that a.t.m.
i
@Erik Osterman (Cloud Posse) I think this is the issue I was seeing as well. The
hooks
are all root-level
e
I’ll see if I can create a reproduce case
@Duffy Gillman if you can compare my test cases with how you are defining your imports, I think we'll figure out where the problem is.