chamber icon indicating copy to clipboard operation
chamber copied to clipboard

Import should lowercase all keys

Open skorfmann opened this issue 8 years ago • 14 comments

When importing a JSON file with uppercase keys, they are imported as is. If I write a key via chamber write, the key is lowercased. This leads to duplicated keys. Plus, it breaks the read / delete command, since it apparently assumes lowercased keys.

skorfmann avatar Oct 16 '18 14:10 skorfmann

Which leads to the question, how does one clean up uppercase keys?

ttheune avatar Nov 14 '18 14:11 ttheune

Which leads to the question, how does one clean up uppercase keys?

I think we just exported the keys, changed them manually and imported them again :)

skorfmann avatar Nov 14 '18 15:11 skorfmann

Which leads to the question, how does one clean up uppercase keys?

I think we just exported the keys, changed them manually and imported them again :)

Which gives me duplicates, I'm trying to remove the old UPPERCASE entirely to resolve ENV confusion.
Is the best practice here to go into SSM manually and clean it up? (And any old services etc etc?)

ttheune avatar Nov 14 '18 16:11 ttheune

What's the motivation behind lowercasing all of the keys? Environment variables are commonly represented as all uppercase and it makes it easier to read the actual config key names when visually parsing through Parameter Store on AWS Console.

aharasta-earnup avatar Nov 20 '18 23:11 aharasta-earnup

Agree with @aharasta-earnup , we use aws-env to export environment variables, write convert all key to lower cases, not expected behavior.

af6140 avatar Jan 08 '19 19:01 af6140

Considering this would be breaking behaviour, targeting for chamber 3.

nickatsegment avatar Mar 06 '19 21:03 nickatsegment

@nickatsegment are you saying that #162 is breaking solely because of the below?

Modify import to fail an import payload when mixed case keys are provided except when the --case-sensitive switch is passed

Having been hit by this bug it feels like the breaking behaviour is already present and the changes in #162 are a minimally invasive fix? If you disagree and want to push to v3 would you consider accepting #162 into v2 if the imports change warned instead of failing?

eyablonowitz avatar Mar 07 '19 15:03 eyablonowitz

Hm, I think my strategy is to accept #162 (pending the docs and tests I was looking for), and target a "real" fix at the model level for v3. Obviously case sensitivity is a thing we have to deal with (if not outright support in the TF_VAR case) and I'd like to deal with it in the core design.

nickatsegment avatar Mar 12 '19 00:03 nickatsegment

This issue has been automatically marked stale because it has not had any activity in the last 60 days. If no further activity occurs within 7 days, it will be closed. Closed does not mean "never", just that it has no momentum to get accomplished any time soon. See CONTRIBUTING.md for more info.

stale[bot] avatar May 11 '19 01:05 stale[bot]

Closing due to staleness. Closed does not mean "never", just that it has no momentum to get accomplished any time soon. See CONTRIBUTING.md for more info.

stale[bot] avatar May 18 '19 02:05 stale[bot]

For anyone else hitting this, you can remove the uppercased keys with the awscli:

aws ssm delete-parameters --name "{service}/{KEY}"

ipmb avatar Nov 07 '19 00:11 ipmb

Looks like there hasn't been much movement on this in a while. Is any help needed to push it along? It is still greatly affecting usability of the tool for me.

wendtek avatar Jun 29 '21 16:06 wendtek

As of https://github.com/segmentio/chamber/releases/tag/v2.12.0, this can now be resolved with

chamber import --normalize-keys

Some more details in the README

This should provide the expected functionality in a non-breaking manner. In a future version, it is likely that this becomes the default behavior

alecjacobs5401 avatar Feb 28 '23 16:02 alecjacobs5401

Closing; still attached to the v3.0 milestone and may be revisited in the future.

mckern avatar May 12 '23 01:05 mckern