Skip to content

Commit

Permalink
fix: raw file content (#1035)
Browse files Browse the repository at this point in the history
* fix: raw file content

* chore: self mutation

Signed-off-by: github-actions <[email protected]>

---------

Signed-off-by: github-actions <[email protected]>
Co-authored-by: github-actions <[email protected]>
  • Loading branch information
markussiebert and github-actions committed Jun 4, 2024
1 parent 1afcd09 commit ae1735b
Show file tree
Hide file tree
Showing 15 changed files with 3,066 additions and 2,815 deletions.
2 changes: 1 addition & 1 deletion .projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .projenrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { awscdk } = require('projen');
const project = new awscdk.AwsCdkConstructLibrary({
author: 'Markus Siebert',
authorAddress: '[email protected]',
cdkVersion: '2.1.0',
cdkVersion: '2.144.0',
stability: 'stable',
homepage: 'https://constructs.dev/packages/cdk-sops-secrets',
description:
Expand Down
213 changes: 211 additions & 2 deletions API.md

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions lambda/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ func decryptSopsFileContent(content []byte, format string) (data []byte, err err
func (a AWS) updateSecret(sopsHash string, secretArn string, secretContent []byte) (data *secretsmanager.PutSecretValueOutput, err error) {
secretContentString := string(secretContent)
input := &secretsmanager.PutSecretValueInput{
SecretId: &secretArn,
SecretString: &secretContentString,

SecretId: &secretArn,
SecretString: &secretContentString,
ClientRequestToken: &sopsHash,
}
secretResp, secretErr := a.secretsmanager.PutSecretValue(input)
Expand Down Expand Up @@ -156,7 +155,6 @@ func (a AWS) syncSopsToSecretsmanager(ctx context.Context, event cfn.Event) (phy
if err != nil {
return tempArn, nil, err
}
//log.Println(string(decryptedContent))
var decryptedInterface interface{}
switch resourceProperties.Format {
case "json":
Expand Down Expand Up @@ -197,6 +195,7 @@ func (a AWS) syncSopsToSecretsmanager(ctx context.Context, event cfn.Event) (phy
{
resourceProperties.Flatten = "false"
resourceProperties.StringifyValues = "false"
resourceProperties.ConvertToJSON = "false"
}
default:
return "", nil, errors.New(fmt.Sprintf("Format %s not supported", resourceProperties.Format))
Expand Down Expand Up @@ -254,7 +253,6 @@ func (a AWS) syncSopsToSecretsmanager(ctx context.Context, event cfn.Event) (phy
return tempArn, nil, err
}
}

// Write the secret
updateSecretResp, err := a.updateSecret(sopsHash, resourceProperties.SecretARN, decryptedContent)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": "15.0.0",
"version": "36.0.0",
"files": {
"5d28ae171b06a74255e5da3e3fad8477ed5dffc98b55e885ba99f56afe95cd58": {
"ba702541966a10511eb4b7534ec99ec011e3eb46bf38fe5a5d95c03b97bcde67": {
"source": {
"path": "asset.5d28ae171b06a74255e5da3e3fad8477ed5dffc98b55e885ba99f56afe95cd58.zip",
"path": "asset.ba702541966a10511eb4b7534ec99ec011e3eb46bf38fe5a5d95c03b97bcde67.zip",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "5d28ae171b06a74255e5da3e3fad8477ed5dffc98b55e885ba99f56afe95cd58.zip",
"objectKey": "ba702541966a10511eb4b7534ec99ec011e3eb46bf38fe5a5d95c03b97bcde67.zip",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down Expand Up @@ -79,15 +79,15 @@
}
}
},
"3df20cebd8befd8c2eee521149078eeef238b022cabf42327fc78fa91a5e1539": {
"6877367a0b0bf6c211df7db09e390a34f27dde480c9c7591a54f097775ed6c47": {
"source": {
"path": "SecretIntegrationAsset.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "3df20cebd8befd8c2eee521149078eeef238b022cabf42327fc78fa91a5e1539.json",
"objectKey": "6877367a0b0bf6c211df7db09e390a34f27dde480c9c7591a54f097775ed6c47.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Loading

0 comments on commit ae1735b

Please sign in to comment.