nsmithuk / local-kms

A mock version of AWS' Key Management Service, for local development and testing.
MIT License
198 stars 34 forks source link

Missing TrentService.GetKeyPolicy for Terraform. #9

Closed wesselvdv closed 5 years ago

wesselvdv commented 5 years ago

Seems this local implementation is missing TrentService.GetKeyPolicy for Terraform. I am able to deploy a kms key locally using this lib, but refreshing the state seems to require another route that isn't implemented. I could take a swing at it, see if I can create it myself.

nsmithuk commented 5 years ago

Hello @wesselvdv

Yes, you're right, no endpoints relating to Key Policies have been implemented yet. I've never used that endpoint myself, so I'm not sure how complex it would be to do. Please do go ahead and give it a go though. I'm happy to help where I can.

wesselvdv commented 5 years ago

After taking a look at the AWS docs regarding this specific route, it seems I could add a simple 'mock' handler that will always return the name default as the key policy. Which is actually correct since the TrentService.CreateKey handler in this local implementation doesn't support the Policy property.

Another approach could be to add handlers for TrentService.PutKeyPolicy&TrentService.GetKeyPolicy, and add the Policy property to the TrentService.CreateKey handler which would at least make sure that if given a custom policy it could return the correct custom one.

EDIT:

I'll try to give it a shot, my GoLang skills might be a bit rusty.

nsmithuk commented 5 years ago

@wesselvdv Thank you for your contribution on this.

It's merged in and available under the following tags: