How to add new key-value pair in secrets manager without impacting existing key and values in aws CDK

Viewed 21

I have created aws stack in python which create new secret in secrets manager. When I execute the code, stack created successfully and given secret and all provided keys-values listed successfully. Below is the code.

templated_secret = asm.Secret(self, "abzzzz11", 
description="ddddd",secret_name="hahahah",
        generate_secret_string=asm.SecretStringGenerator(
            secret_string_template=json.dumps({"username1": "", "password1": "","password2": "hello-world-prod2"}),
            generate_string_key="qwe"                
        )
   )

I have below two question:

Question 1: After creating secrets, values will be changed against keys for dev or stage environment. Now a new Key and value needs to be added for same secret. But after adding new values in my code when I execute the stack then it replace all the values. So is it possible that system only add those values which does not exist on aws secret manager?

Question 2: I am unable to understand the purpose/use of generate_string_key in above code. I read the aws documentation but unable to understand the purpose of this field. So please help me to understand the usage of this field.

0 Answers
Related