@aptos-scp/isl-component-resource-definition 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ resource-definition deploy --stack-name %STACK_NAME%
|
|
|
24
24
|
|
|
25
25
|
### Parameter Overrides
|
|
26
26
|
|
|
27
|
-
The `PARAMETER_OVERRIDE` environment variable supports special handling for nested environment variables
|
|
27
|
+
The `PARAMETER_OVERRIDE` environment variable supports special handling for nested environment variables. When `%PARAMETER_OVERRIDE%` is used, the `--parameter-overrides` flag is automatically added if there are resolved values.
|
|
28
28
|
|
|
29
29
|
#### Key-Value with Environment Variable Reference
|
|
30
30
|
|
|
@@ -33,7 +33,7 @@ The `PARAMETER_OVERRIDE` environment variable supports special handling for nest
|
|
|
33
33
|
# PARAMETER_OVERRIDE="IslSample=$ISL_SAMPLE IslResponseEventbusArn=arn:aws:events:eu-west-1:123456789:event-bus/my-bus"
|
|
34
34
|
# ISL_SAMPLE=sample-value
|
|
35
35
|
|
|
36
|
-
resource-definition deploy
|
|
36
|
+
resource-definition deploy %PARAMETER_OVERRIDE%
|
|
37
37
|
# Executes: sam deploy --parameter-overrides IslSample=sample-value IslResponseEventbusArn=arn:aws:events:eu-west-1:123456789:event-bus/my-bus
|
|
38
38
|
```
|
|
39
39
|
|
|
@@ -46,10 +46,26 @@ When `PARAMETER_OVERRIDE` contains `$ENV_VAR_NAME` without a key, the environmen
|
|
|
46
46
|
# PARAMETER_OVERRIDE="$ISL_RESPONSE_EVENTBUS_ARN"
|
|
47
47
|
# ISL_RESPONSE_EVENTBUS_ARN=arn:aws:events:eu-west-1:123456789:event-bus/my-bus
|
|
48
48
|
|
|
49
|
-
resource-definition deploy
|
|
49
|
+
resource-definition deploy %PARAMETER_OVERRIDE%
|
|
50
50
|
# Executes: sam deploy --parameter-overrides IslResponseEventbusArn=arn:aws:events:eu-west-1:123456789:event-bus/my-bus
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
+
#### Empty Standalone Environment Variable
|
|
54
|
+
|
|
55
|
+
When a standalone `$ENV_VAR_NAME` resolves to an empty value or is not set, it is skipped entirely to prevent SAM deploy failures:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Environment variables:
|
|
59
|
+
# PARAMETER_OVERRIDE="$UMBRELLA_PRINCIPAL_ARN"
|
|
60
|
+
# UMBRELLA_PRINCIPAL_ARN=
|
|
61
|
+
|
|
62
|
+
resource-definition deploy %PARAMETER_OVERRIDE%
|
|
63
|
+
# Executes: sam deploy
|
|
64
|
+
# Note: --parameter-overrides is omitted entirely because the env variable is empty
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
A debug message will be logged when this occurs: `Skipping parameter override: UMBRELLA_PRINCIPAL_ARN is empty or not set`
|
|
68
|
+
|
|
53
69
|
#### Mixed Format
|
|
54
70
|
|
|
55
71
|
```bash
|
|
@@ -58,7 +74,7 @@ resource-definition deploy --parameter-overrides %PARAMETER_OVERRIDE%
|
|
|
58
74
|
# ISL_SAMPLE=sample-value
|
|
59
75
|
# CUSTOM_VALUE=custom-resolved
|
|
60
76
|
|
|
61
|
-
resource-definition deploy
|
|
77
|
+
resource-definition deploy %PARAMETER_OVERRIDE%
|
|
62
78
|
# Executes: sam deploy --parameter-overrides IslSample=sample-value CustomKey=custom-resolved StaticKey=static-value
|
|
63
79
|
```
|
|
64
80
|
|
|
@@ -17,7 +17,7 @@ class SamResourceDefinition {
|
|
|
17
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
18
|
const execPromise = util.promisify(child_process_1.exec);
|
|
19
19
|
const evaluatedArgs = this.evaluateEnvVars(args);
|
|
20
|
-
const samCommand = `sam ${inputCommand} ${evaluatedArgs.join(" ")}
|
|
20
|
+
const samCommand = `sam ${inputCommand} ${evaluatedArgs.filter((arg) => arg !== "").join(" ")}`.trim();
|
|
21
21
|
console.log(`Executing command: ${samCommand}`);
|
|
22
22
|
const { stdout, stderr } = yield execPromise(samCommand);
|
|
23
23
|
console.log(`SAM Execute Output: ${stdout}`);
|
|
@@ -32,7 +32,11 @@ class SamResourceDefinition {
|
|
|
32
32
|
const envVar = arg.slice(1, -1);
|
|
33
33
|
const envValue = process.env[envVar] || "";
|
|
34
34
|
if (envVar === "PARAMETER_OVERRIDE") {
|
|
35
|
-
|
|
35
|
+
const resolvedValue = this.evaluateParameterOverride(envValue);
|
|
36
|
+
if (resolvedValue.trim() === "") {
|
|
37
|
+
return "";
|
|
38
|
+
}
|
|
39
|
+
return `--parameter-overrides ${resolvedValue}`;
|
|
36
40
|
}
|
|
37
41
|
return envValue;
|
|
38
42
|
}
|
|
@@ -48,8 +52,13 @@ class SamResourceDefinition {
|
|
|
48
52
|
// Handle standalone $ENV_VAR without key=value format
|
|
49
53
|
if (equalsIndex === -1 && pair.startsWith("$")) {
|
|
50
54
|
const envVarName = pair.slice(1);
|
|
51
|
-
const pascalCaseKey = this.snakeCaseToPascalCase(envVarName);
|
|
52
55
|
const envValue = process.env[envVarName] || "";
|
|
56
|
+
// Skip if env variable is empty
|
|
57
|
+
if (envValue === "") {
|
|
58
|
+
console.debug(`Skipping parameter override: ${envVarName} is empty or not set`);
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
const pascalCaseKey = this.snakeCaseToPascalCase(envVarName);
|
|
53
62
|
return `${pascalCaseKey}=${envValue}`;
|
|
54
63
|
}
|
|
55
64
|
if (equalsIndex === -1) {
|
|
@@ -64,6 +73,7 @@ class SamResourceDefinition {
|
|
|
64
73
|
}
|
|
65
74
|
return pair;
|
|
66
75
|
})
|
|
76
|
+
.filter((item) => item !== null)
|
|
67
77
|
.join(" ");
|
|
68
78
|
}
|
|
69
79
|
snakeCaseToPascalCase(snakeCase) {
|