-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a example for secretmanager.SecretVersion (#3079)
This example shows how to add multiple secrets via a json KV blob. Fixes #3042
- Loading branch information
Showing
8 changed files
with
42 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
pulumi>=3.0.0,<4.0.0 | ||
pulumi_aws>=5.0.0,<6.0.0 | ||
pulumi_aws>=6.0.0,<7.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: secretmanager-py | ||
runtime: python | ||
description: A simple example of using the Secret Manager APIs using Python. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import json | ||
from pulumi_aws.secretsmanager import Secret, SecretVersion | ||
|
||
# Create an AWS Secret for RDS | ||
rds_secret = Secret("db", | ||
description="RDS Database secret", | ||
kms_key_id="alias/aws/secretsmanager", # default KMS key | ||
) | ||
|
||
# Define the secret value | ||
secret_string = json.dumps({ | ||
"username": "username", | ||
"password": "password", | ||
"engine": "mysql", | ||
"host": "<endpoint>", | ||
"port": 3306, | ||
"dbname": "<db_name>", | ||
}) | ||
|
||
# Create a secret version in AWS Secrets Manager with the secret value | ||
rds_secret_version = SecretVersion("version", | ||
secret_id=rds_secret.id, | ||
secret_string=secret_string, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pulumi>=3.0.0,<4.0.0 | ||
pulumi_aws>=6.0.0,<7.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
pulumi>=3.0.0,<4.0.0 | ||
pulumi_aws>=5.0.0,<6.0.0 | ||
pulumi_aws>=6.0.0,<7.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
pulumi>=3.0.0,<4.0.0 | ||
pulumi_aws>=5.0.0,<6.0.0 | ||
pulumi_aws>=6.0.0,<7.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
pulumi>=3.0.0,<4.0.0 | ||
pulumi_aws>=5.0.0,<6.0.0 | ||
pulumi_aws>=6.0.0,<7.0.0 |