{"_id":"@mapbox/cfn-template-audit","_rev":"258-a31781772150bc8a042fe394f5d94219","name":"@mapbox/cfn-template-audit","description":"Read all the CloudFormation templates in an AWS account","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@mapbox/cfn-template-audit","version":"1.0.0","description":"Read all the CloudFormation templates in an AWS account","main":"index.js","scripts":{"prettier":"prettier --single-quote --write *.js","test":"nyc tape test/*.test.js | tap-spec"},"repository":{"type":"git","url":"git+https://github.com/mapbox/cfn-template-audit.git"},"author":{"name":"Mapbox"},"license":"ISC","bugs":{"url":"https://github.com/mapbox/cfn-template-audit/issues"},"homepage":"https://github.com/mapbox/cfn-template-audit#readme","devDependencies":{"eslint":"^3.19.0","eslint-config-prettier":"^1.7.0","eslint-plugin-node":"^4.2.2","eslint-plugin-prettier":"^2.0.1","nyc":"^10.2.0","opener":"^1.4.3","prettier":"^1.2.2","tap-spec":"^4.1.1","tape":"^4.6.3"},"dependencies":{"aws-sdk":"^2.45.0","p-queue":"^1.0.0"},"gitHead":"45042beb88f04f4f19a8efbfb04eb816984ebd4f","_id":"@mapbox/cfn-template-audit@1.0.0","_shasum":"a6939a6dc42847da9056f956061f79864ea9c061","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.0","_npmUser":{"name":"rclark","email":"ryan.clark.j@gmail.com"},"dist":{"shasum":"a6939a6dc42847da9056f956061f79864ea9c061","tarball":"https://registry.npmjs.org/@mapbox/cfn-template-audit/-/cfn-template-audit-1.0.0.tgz","integrity":"sha512-rGK+4ivyCGDnY0HnjMwiRpCVQJ/Chh9om5RLC3sRV9BSaMbYimEo/Dhk8LJWO05pXLba6OBPmnQGINRH2o/r2g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDGn4JJy0UV3m/cC2a6IwyAQlyg06+7XBF66VSbGkWyXAIgOzg0Co004Irni0t2BhD996lpygTE4XOYSoBtthESg/s="}]},"maintainers":[{"name":"rclark","email":"ryan.clark.j@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/cfn-template-audit-1.0.0.tgz_1493140999627_0.8798366982955486"},"directories":{}}},"readme":"# cfn-template-audit\n\nRead all the CloudFormation templates in an AWS account\n\n## Usage\n\n#### Which statuses are you interested in?\n\nSpecify the stack statuses you are interested in auditing as an array. If you don't care, then don't bother. The following statuses will be included in your results:\n\n```js\n[\n  'CREATE_IN_PROGRESS',\n  'CREATE_FAILED',\n  'CREATE_COMPLETE',\n  'ROLLBACK_IN_PROGRESS',\n  'ROLLBACK_FAILED',\n  'ROLLBACK_COMPLETE',\n  'DELETE_IN_PROGRESS',\n  'DELETE_FAILED',\n  'UPDATE_IN_PROGRESS',\n  'UPDATE_COMPLETE_CLEANUP_IN_PROGRESS',\n  'UPDATE_COMPLETE',\n  'UPDATE_ROLLBACK_IN_PROGRESS',\n  'UPDATE_ROLLBACK_FAILED',\n  'UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS',\n  'UPDATE_ROLLBACK_COMPLETE',\n  'REVIEW_IN_PROGRESS'\n]\n```\n\n#### What are you looking for inside the templates?\n\nWrite a function that accepts _a single template as a string_, and then returns `true` or `false` indicating that it should or should not be included in your results. If you want everything, don't bother with this step.\n\n```js\nconst templateFilter = template =>\n  JSON.parse(template).Resources.SomeResourceName.Type === 'AWS::SNS::Topic';\n```\n\nIf you need to do any asynchronous I/O to determine which templates to include in the results, simply return a Promise that resolves to a boolean value.\n\n```js\nconst templateFilter = template =>\n  new Promise((resolve, reject) =>\n    asynchronousCheck(template, (err, accept) => {\n      if (err) return reject(err);\n      return resolve(accept); // accept is `true` or `false`\n    })\n  );\n```\n\n#### Roll it up into a script\n\n```js\nconst audit = require('@mapbox/cfn-template-audit');\nconst conditions = {\n  statuses: ['CREATE_COMPLETE'],\n  templateFilter: template =>\n    JSON.parse(template).Resources.SomeResourceName.Type === 'AWS::SNS::Topic'\n};\n\naudit.getWorldWideTemplates(conditions).then(data =>\n  console.log(\n    data.map(stack => `${stack.Summary.StackName} ${stack.Region}`)\n  );\n);\n```\n\nIf you don't have any conditions (you want to see everything), then just go for it:\n\n```js\naudit.getWorldWideTemplates().then(data =>\n  console.log(\n    data.map(stack => `${stack.Summary.StackName} ${stack.Region}`)\n  );\n);\n```\n\nIf you're only interested in a single region, there's a function for that:\n\n```js\naudit.getTemplates('us-east-1', conditions).then(data => ...);\n```\n\n#### What do I get out of this?\n\nYou get back an array of objects with the following properties:\n\n```js\n{\n  Summary: {\n    StackId: 'Unique stack identifier',\n    StackName: 'The name associated with the stack',\n    TemplateDescription: 'The description of the template used to create the stack',\n    CreationTime: 'The time the stack was created',\n    LastUpdatedTime: 'The time the stack was last updated',\n    DeletionTime: 'The time the stack was deleted',\n    StackStatus: 'The current status of the stack',\n    StackStatusReason: 'Success/Failure message associated with the stack status'\n  },\n  TemplateBody: 'The template itself as a string',\n  Region: 'The AWS region the template is in'\n}\n```\n\nThe array will be sorted alphabetically by stack name.\n","maintainers":[{"email":"yannick.meeus+npm+production+ci@mapbox.com","name":"mbx-npm-ci-production"},{"email":"yannick.meeus+npm+staging+ci@mapbox.com","name":"mbx-npm-ci-staging"},{"email":"yannick.meeus+npm+prod+advanced+actions@mapbox.com","name":"mbx-npm-advanced-actions-production"},{"email":"yannick.meeus+npm+staging+advanced+actions@mapbox.com","name":"mbx-npm-advanced-actions-staging"},{"email":"yannick.meeus+npm+prod+09@mapbox.com","name":"mbx-npm-09-production"},{"email":"yannick.meeus+npm+prod+08@mapbox.com","name":"mbx-npm-08-production"},{"email":"yannick.meeus+npm+prod+07@mapbox.com","name":"mbx-npm-07-production"},{"email":"yannick.meeus+npm+prod+06@mapbox.com","name":"mbx-npm-06-production"},{"email":"yannick.meeus+npm+prod+05@mapbox.com","name":"mbx-npm-05-production"},{"email":"yannick.meeus+npm+prod+04@mapbox.com","name":"mbx-npm-04-production"},{"email":"yannick.meeus+npm+prod+03@mapbox.com","name":"mbx-npm-03-production"},{"email":"yannick.meeus+npm+prod+02@mapbox.com","name":"mbx-npm-02-production"},{"email":"yannick.meeus+npm+prod+01@mapbox.com","name":"mbx-npm-01-production"},{"email":"yannick.meeus@mapbox.com","name":"mbx-npm-02-staging"},{"email":"accounts+npmjs-01@mapbox.com","name":"mapbox-npm-01"},{"email":"accounts+npmjs-02@mapbox.com","name":"mapbox-npm-02"},{"email":"accounts+npmjs-07@mapbox.com","name":"mapbox-npm-07"},{"email":"accounts+npmjs-03@mapbox.com","name":"mapbox-npm-03"},{"email":"accounts+npmjs-04@mapbox.com","name":"mapbox-npm-04"},{"email":"accounts+npmjs-09@mapbox.com","name":"mapbox-npm-09"},{"email":"accounts+npmjs-05@mapbox.com","name":"mapbox-npm-05"},{"email":"accounts+npmjs-06@mapbox.com","name":"mapbox-npm-06"},{"email":"accounts+npmjs-08@mapbox.com","name":"mapbox-npm-08"},{"email":"accounts+npmjs-advanced-actions@mapbox.com","name":"mapbox-npm-advanced-actions"},{"email":"accounts+npmjs-npm-ci@mapbox.com","name":"mapbox-npm-ci"},{"email":"accounts+npmjs@mapbox.com","name":"mapbox-npm"},{"email":"accounts@mapbox.com","name":"mapbox-admin"},{"email":"accounts+npm-mapbox-machine-user@mapbox.com","name":"mapbox-machine-user"}],"time":{"modified":"2023-01-12T12:41:14.867Z","created":"2017-04-25T17:23:19.919Z","1.0.0":"2017-04-25T17:23:19.919Z"},"homepage":"https://github.com/mapbox/cfn-template-audit#readme","repository":{"type":"git","url":"git+https://github.com/mapbox/cfn-template-audit.git"},"author":{"name":"Mapbox"},"bugs":{"url":"https://github.com/mapbox/cfn-template-audit/issues"},"license":"ISC","readmeFilename":"readme.md"}