cloudmason 2.2.41 → 2.3.43

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.
@@ -28,14 +28,14 @@ exports.main = async function(args){
28
28
 
29
29
  // Wait for Version Availability Function
30
30
  const waitForVersionAvailability = async (client, productId, version) => {
31
- const maxAttempts = 1080; // 90 minutes with 5-second intervals (90 * 60 / 5 = 1080)
31
+ const maxAttempts = 180; // 90 minutes with 30-second intervals (90 * 60 / 30 = 180)
32
32
  let attempts = 0;
33
33
 
34
34
  console.log(`Polling entity for version ${version} availability...`);
35
- console.log(`Timeout: 90 minutes (will check every 5 seconds)`);
35
+ console.log(`Timeout: 90 minutes (will check every 30 seconds)`);
36
36
 
37
37
  while (attempts < maxAttempts) {
38
- await new Promise(resolve => setTimeout(resolve, 5000)); // Wait 5 seconds
38
+ await new Promise(resolve => setTimeout(resolve, 30000)); // Wait 30 seconds
39
39
 
40
40
  try {
41
41
  const describeEntityCommand = new DescribeEntityCommand({
@@ -54,7 +54,6 @@ const waitForVersionAvailability = async (client, productId, version) => {
54
54
  }
55
55
  // Check if version exists in Versions array
56
56
  const versionInfo = details.Versions?.find(v => v.VersionTitle === version);
57
- console.log('Version details:', versionInfo);
58
57
 
59
58
  if (versionInfo) {
60
59
  // Check 1: Version must have Sources array with AMI
@@ -1,4 +1,4 @@
1
- const { CloudFormationClient,ListStackResourcesCommand, CreateStackCommand,UpdateStackCommand, DeleteStackCommand, ValidateTemplateCommand,DescribeStacksCommand } = require('@aws-sdk/client-cloudformation');
1
+ const { CloudFormationClient,ListStackResourcesCommand, CreateStackCommand,UpdateStackCommand, DeleteStackCommand, ValidateTemplateCommand,DescribeStacksCommand, GetTemplateSummaryCommand } = require('@aws-sdk/client-cloudformation');
2
2
 
3
3
  const fs = require('fs');
4
4
  const path = require('path')
@@ -84,7 +84,15 @@ exports.updateOrgStack = async function(yamlPath){
84
84
 
85
85
  exports.updateStack = async function(stackName,s3Url,params,region){
86
86
  const client = new CloudFormationClient({ region });
87
- const cfParams = Object.keys(params).map(k=>{ return { ParameterKey: k, ParameterValue: params[k] } })
87
+
88
+ // Get the template's declared parameters so we only pass ones that exist
89
+ const summary = await client.send(new GetTemplateSummaryCommand({ TemplateURL: s3Url }));
90
+ const templateParamKeys = new Set((summary.Parameters || []).map(p => p.ParameterKey));
91
+
92
+ const cfParams = Object.keys(params)
93
+ .filter(k => templateParamKeys.has(k))
94
+ .map(k => { return { ParameterKey: k, ParameterValue: params[k] } });
95
+
88
96
  const cmd = {
89
97
  StackName: stackName,
90
98
  TemplateURL: s3Url,
@@ -39,7 +39,7 @@ exports.main = async function(args){
39
39
  const amiAlias = `/aws/service/marketplace/${pubArgs.productId}/${pubArgs.version}`;
40
40
  console.log('AMI Alias:',amiAlias);
41
41
  let stackTxt = fs.readFileSync(path.resolve(args.stack),'utf8');
42
- stackTxt = stackTxt.replace(`ImageId: !Ref AmiId`,`ImageId: resolve:ssm:${amiAlias}`);
42
+ // stackTxt = stackTxt.replace(`ImageId: !Ref AmiId`,`ImageId: resolve:ssm:${amiAlias}`);
43
43
  stackTxt = stackTxt.replace(/^#-Strip.+#-Strip/ms,'');
44
44
 
45
45
  // -- Update CF Template with AMI IDs
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"cloudmason","version":"2.2.41","description":"","main":"main.js","scripts":{"build":"node build.js"},"bin":{"mason":"./main.js"},"repository":{"type":"git","url":"https://github.com/kai-harvey/cloudmason.git"},"author":"Kai Harvey","license":"ISC","dependencies":{"@aws-sdk/client-acm":"^3.418.0","@aws-sdk/client-auto-scaling":"^3.470.0","@aws-sdk/client-cloudformation":"^3.418.0","@aws-sdk/client-ec2":"^3.864.0","@aws-sdk/client-iam":"^3.864.0","@aws-sdk/client-marketplace-catalog":"^3.716.0","@aws-sdk/client-route-53":"^3.425.0","@aws-sdk/client-s3":"^3.418.0","@aws-sdk/client-ssm":"^3.421.0","adm-zip":"^0.5.10","ssh2":"^1.16.0","yaml":"^2.6.1"}}
1
+ {"name":"cloudmason","version":"2.3.43","description":"","main":"main.js","scripts":{"build":"node build.js"},"bin":{"mason":"./main.js"},"repository":{"type":"git","url":"https://github.com/kai-harvey/cloudmason.git"},"author":"Kai Harvey","license":"ISC","dependencies":{"@aws-sdk/client-acm":"^3.418.0","@aws-sdk/client-auto-scaling":"^3.470.0","@aws-sdk/client-cloudformation":"^3.418.0","@aws-sdk/client-ec2":"^3.864.0","@aws-sdk/client-iam":"^3.864.0","@aws-sdk/client-marketplace-catalog":"^3.716.0","@aws-sdk/client-route-53":"^3.425.0","@aws-sdk/client-s3":"^3.418.0","@aws-sdk/client-ssm":"^3.421.0","adm-zip":"^0.5.10","ssh2":"^1.16.0","yaml":"^2.6.1"}}