-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix static get function for ssm.parameter with versioned or labeled I…
…Ds (#4014) When the upstream SSM resources where moved to the AWS SDK v2 the lookup of SSM parameters with versions or labels got broken. This fixes that again. Fixes #4011
- Loading branch information
1 parent
1638e1b
commit b61bb34
Showing
7 changed files
with
129 additions
and
0 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
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: regress-4011 | ||
runtime: nodejs | ||
description: Regress pulumi/pulumi-aws#4011 |
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 @@ | ||
// Copyright 2016-2024, Pulumi Corporation. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import * as pulumi from "@pulumi/pulumi"; | ||
import * as aws from "@pulumi/aws"; | ||
|
||
const param = new aws.ssm.Parameter('regress-4011-test-secret', { | ||
name: 'regress-4011-test-secret', | ||
type: 'SecureString', | ||
value: "test", | ||
}); | ||
|
||
export const secret = pulumi.output(param).arn; |
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,16 @@ | ||
{ | ||
"name": "regress-4011", | ||
"version": "0.0.1", | ||
"license": "Apache-2.0", | ||
"scripts": { | ||
"build": "tsc" | ||
}, | ||
"dependencies": { | ||
"@pulumi/pulumi": "^3.0.0", | ||
"@pulumi/aws": "^6.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/aws-sdk": "^2.7.0", | ||
"@types/node": "^8.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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2016-2024, Pulumi Corporation. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import * as pulumi from "@pulumi/pulumi"; | ||
import * as aws from "@pulumi/aws"; | ||
|
||
const param = new aws.ssm.Parameter('regress-4011-test-secret', { | ||
name: 'regress-4011-test-secret', | ||
type: 'SecureString', | ||
value: "test", | ||
}); | ||
|
||
const retrievedParam = aws.ssm.Parameter.get('retrieved-parameter', 'regress-4011-test-secret:1'); | ||
|
||
export const secret = pulumi.output(param).arn; | ||
export const retrievedSecret = pulumi.output(retrievedParam).arn; |
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,18 @@ | ||
{ | ||
"compilerOptions": { | ||
"strict": true, | ||
"outDir": "bin", | ||
"target": "es2016", | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"sourceMap": true, | ||
"experimentalDecorators": true, | ||
"pretty": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitReturns": true, | ||
"forceConsistentCasingInFileNames": true | ||
}, | ||
"files": [ | ||
"index.ts" | ||
] | ||
} |
23 changes: 23 additions & 0 deletions
23
patches/0059-Fix-static-get-function-for-ssm.parameter-with-versi.patch
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,23 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Florian Stadler <[email protected]> | ||
Date: Mon, 3 Jun 2024 21:23:04 +0200 | ||
Subject: [PATCH] Fix static get function for ssm.parameter with versioned or | ||
labled IDs | ||
|
||
When the SSM resources where moved to the AWS SDK v2 the lookup of | ||
SSM parameters with versions or labels got broken. This fixes that | ||
again. | ||
|
||
diff --git a/internal/service/ssm/parameter.go b/internal/service/ssm/parameter.go | ||
index 5a24c9641a..09d7cfea45 100644 | ||
--- a/internal/service/ssm/parameter.go | ||
+++ b/internal/service/ssm/parameter.go | ||
@@ -259,7 +259,7 @@ func resourceParameterRead(ctx context.Context, d *schema.ResourceData, meta int | ||
return sdkdiag.AppendErrorf(diags, "invalid configuration, cannot set type = %s and insecure_value", param.Type) | ||
} | ||
|
||
- detail, err := findParameterMetadataByName(ctx, conn, d.Id()) | ||
+ detail, err := findParameterMetadataByName(ctx, conn, *param.Name) | ||
|
||
if !d.IsNewResource() && tfresource.NotFound(err) { | ||
log.Printf("[WARN] SSM Parameter %s not found, removing from state", d.Id()) |