├── .github ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE │ └── config.yml ├── PULL_REQUEST_TEMPLATE.md └── SECURITY.md ├── .gitignore ├── LICENSE ├── README.md ├── assets ├── terraform-cost-estimation.png └── terraform-cost-estimation.psd ├── docs ├── CNAME ├── index.html ├── main.js └── style.css ├── samples ├── opa │ └── terraform-cost-estimation.rego ├── terraform-code │ ├── .gitignore │ ├── data.tf │ ├── main.tf │ └── plan.json ├── terraform012-plan.json └── terraform012-state.json └── terraform.jq /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies within all project spaces, and it also applies when 49 | an individual is representing the project or its community in public spaces. 50 | Examples of representing a project or community include using an official 51 | project e-mail address, posting via an official social media account, or acting 52 | as an appointed representative at an online or offline event. Representation of 53 | a project may be further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at anton@antonbabenko.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guidelines 2 | 3 | Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional 4 | documentation, we greatly value feedback and contributions from our community. 5 | 6 | Please read through this document before submitting any issues or pull requests to ensure we have all the necessary 7 | information to effectively respond to your bug report or contribution. 8 | 9 | 10 | ## Reporting Bugs/Feature Requests 11 | 12 | We welcome you to use the GitHub issue tracker to report bugs or suggest features. 13 | 14 | When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already 15 | reported the issue. Please try to include as much information as you can. Details like these are incredibly useful: 16 | 17 | * A reproducible test case or series of steps 18 | * The version of our code being used 19 | * Any modifications you've made relevant to the bug 20 | * Anything unusual about your environment or deployment 21 | 22 | 23 | ## Contributing via Pull Requests 24 | Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that: 25 | 26 | 1. You are working against the latest source on the *master* branch. 27 | 2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already. 28 | 3. You open an issue to discuss any significant work - we would hate for your time to be wasted. 29 | 30 | To send us a pull request, please: 31 | 32 | 1. Fork the repository. 33 | 2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change. 34 | 3. Ensure local tests pass. 35 | 4. Commit to your fork using clear commit messages. 36 | 5. Send us a pull request, answering any default questions in the pull request interface. 37 | 6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation. 38 | 39 | GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and 40 | [creating a pull request](https://help.github.com/articles/creating-a-pull-request/). 41 | 42 | 43 | ## Finding contributions to work on 44 | Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start. 45 | 46 | 47 | ## Code of Conduct 48 | This project has adopted the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 49 | 50 | [homepage]: https://www.contributor-covenant.org 51 | 52 | For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq 53 | 54 | 55 | ## Licensing 56 | 57 | See the LICENSE file for our project's licensing. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Description 2 | 3 | 4 | ## Motivation and Context 5 | 6 | 7 | 8 | ## Breaking Changes 9 | 10 | 11 | 12 | ## How Has This Been Tested? 13 | 14 | 15 | 16 | 17 | ## Screenshots (if appropriate): 18 | -------------------------------------------------------------------------------- /.github/SECURITY.md: -------------------------------------------------------------------------------- 1 | ## Reporting a Vulnerability 2 | 3 | If you discover a potential security issue in this project please notify me via email to anton@antonbabenko.com. 4 | 5 | Please do **not** create a public github issue. 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | work -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Anonymized, secure and free Terraform Cost Estimation 2 | 3 | `cost.modules.tf` is entirely free cost estimation service, which is part of [modules.tf](https://modules.tf) that is currently in active development. 4 | 5 | Join the mailing list on [modules.tf](https://modules.tf) to stay updated! 6 | 7 | This is not an official HashiCorp product. 8 | 9 | ## tldr; Post your Terraform state or plan-file (as JSON) and get cost estimation: 10 | 11 | ``` 12 | $ terraform state pull | curl -s -X POST -H "Content-Type: application/json" -d @- https://cost.modules.tf/ 13 | 14 | {"hourly": 0.01, "monthly": 9.07} 15 | ``` 16 | 17 | NB: Cost estimation uses official [AWS pricing data](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/price-changes.html) and does not include estimates for items not specified in Terraform configurations (e.g., usage patterns, amount of API calls, bandwidth, disk I/O, spot prices, AWS discounts, etc.). 18 | 19 | It is sometimes impossible to extract all information required for cost estimations from the Terraform plan provided, and it is more accurate to get estimates from the Terraform state file after the infrastructure is created. 20 | 21 | See the list of [supported resources](#supported-resources). 22 | 23 | 24 | ## Secrets and sensitive information 25 | 26 | As you probably know, **Terraform state and plan files may contain secrets and sensitive information** which you don't want to send anywhere to get cost estimates. There is a solution that is supported, secure, and easy to put in your continuous automation process. 27 | 28 | All you need to do is to process the Terraform state or plan file with [terraform.jq file](https://github.com/antonbabenko/terraform-cost-estimation/blob/master/terraform.jq) which is available in this repository. 29 | 30 | > Make sure that JQ version 1.6 is installed. Many Linux distributions install older version by default, and you need to update it as described in the [official documentation](https://stedolan.github.io/jq/download/). 31 | 32 | `terraform.jq` creates **anonymized cost keys** sufficient to perform cost estimation. 33 | 34 | For example, cost keys for a single EC2 instance and an Application Load Balancer in `eu-west-1` region look like this: 35 | ``` 36 | { 37 | "keys": [ 38 | "ec2#eu-west-1#t3.nano#shared#linux", 39 | "ec2#eu-west-1#alb" 40 | ] 41 | } 42 | ``` 43 | 44 | The whole process looks like this: 45 | 46 | ``` 47 | # Download terraform.jq file 48 | $ curl -sLO https://raw.githubusercontent.com/antonbabenko/terraform-cost-estimation/master/terraform.jq 49 | 50 | # Get terraform state (or plan), extract cost keys, send them to cost estimation service 51 | $ terraform state pull | jq -cf terraform.jq | curl -s -X POST -H "Content-Type: application/json" -d @- https://cost.modules.tf/ 52 | 53 | {"hourly": 0.01, "monthly": 9.07} 54 | ``` 55 | 56 | Sweet, isn't it? 57 | 58 | 59 | ## Things you should know about infrastructure costs: 60 | 61 | - [x] How much does my infrastructure is going to cost **before** create? 62 | - [x] How much does my infrastructure cost **after** it is created (based on Terraform state)? 63 | - [x] What is the **difference in the price** comparing to the current infrastructure (based on Terraform plan)? 64 | - [x] Can I have cost estimation based on Terraform 0.7 state files? Yes, any version of Terraform state files is supported! 65 | 66 | 67 | ## Example - Get cost estimates during `terraform plan` 68 | 69 | The flow is like this: 70 | 71 | 1. Plan Terraform changes into a plan-file 72 | 2. Convert the plan-file into JSON-file 73 | 3. Extract anonymized cost keys from the JSON-file (optional, but recommended) 74 | 4. Send cost keys to cost.modules.tf 75 | 5. Process response 76 | 77 | Step 3 recommended if you don't want to send the whole JSON-file, which may contain sensitive information. 78 | 79 | The whole command looks like this: 80 | 81 | ``` 82 | # Install jq and download `terraform.jq` file as described in "secrets and sensitive information" section 83 | 84 | $ terraform plan -out=plan.tfplan > /dev/null && terraform show -json plan.tfplan | jq -cf terraform.jq | curl -s -X POST -H "Content-Type: application/json" -d @- https://cost.modules.tf/ 85 | ``` 86 | 87 | Alternatively, you can send the whole Terraform plan-file without modification as json, too: 88 | 89 | ``` 90 | $ terraform plan -out=plan.tfplan > /dev/null && terraform show -json plan.tfplan | curl -s -X POST -H "Content-Type: application/json" -d @- https://cost.modules.tf/ 91 | ``` 92 | 93 | 94 | ### Helpers 95 | 96 | ``` 97 | # Get Terraform plan as json 98 | $ terraform plan -out=plan.tfplan > /dev/null && terraform show -json plan.tfplan > plan.json 99 | 100 | # Get Terraform state as json (option 1) 101 | $ terraform state pull > plan.json 102 | 103 | # Get Terraform state as json (option 2) 104 | $ terraform show -json > plan.json 105 | 106 | # Do something is monthly cost is too high 107 | $ ... | curl -s -X POST -H "Content-Type: application/json" -d @- https://cost.modules.tf/ > costs.json 108 | $ jq 'if .monthly|tonumber > 10 then "$" else "$$$" end' costs.json 109 | ``` 110 | 111 | 112 | ## Supported resources 113 | 114 | 1. EC2 instances (on-demand) and Autoscaling Groups (Launch Configurations and Launch Templates): 115 | - [x] aws_instance 116 | - [x] aws_autoscaling_group 117 | - [x] aws_launch_configuration 118 | - [x] aws_launch_template 119 | 120 | 2. EC2 Fleets (on-demand) 121 | - [x] aws_ec2_fleet 122 | 123 | 3. EBS Volumes, Snapshots, Snapshot Copies 124 | - [x] aws_ebs_volume 125 | - [x] aws_ebs_snapshot 126 | - [x] aws_ebs_snapshot_copy 127 | 128 | 4. Elastic Load Balancing (ELB, ALB, NLB) 129 | - [x] aws_elb 130 | - [x] aws_alb / aws_lb 131 | 132 | 5. NAT Gateways 133 | - [x] aws_nat_gateway 134 | 135 | 136 | Please suggest other resources worth covering by upvoting existing issue or opening new issue. 137 | 138 | As [AWS Community Hero](https://aws.amazon.com/developer/community/heroes/anton-babenko/), I work a lot with AWS, but I am equally interested in covering other popular [Terraform Providers](https://www.terraform.io/docs/providers/) with decent pricing API. 139 | 140 | 141 | ## Like this? Please follow me and share it with your network! 142 | 143 | [![@antonbabenko](https://img.shields.io/twitter/follow/antonbabenko.svg?style=flat&label=Follow%20@antonbabenko%20on%20Twitter)](https://twitter.com/antonbabenko) 144 | [![@antonbabenko](https://img.shields.io/github/followers/antonbabenko?style=flat&label=Follow%20@antonbabenko%20on%20Github)](https://github.com/antonbabenko) 145 | 146 | Consider support my work on [GitHub Sponsors](https://github.com/sponsors/antonbabenko), [Buy me a coffee](https://www.buymeacoffee.com/antonbabenko), or [PayPal](https://www.paypal.me/antonbabenko). 147 | 148 | 149 | ## Disclaimer 150 | 151 | `cost.modules.tf` runs by [Betajob](https://www.betajob.com). We don't save, publish, share with anyone data submitted to the service. 152 | No identifiable customer information used to query pricing systems (check source code of [terraform.jq](https://github.com/antonbabenko/terraform-cost-estimation/blob/master/terraform.jq)). 153 | 154 | `terraform-cost-estimation` project managed by [Anton Babenko](https://github.com/antonbabenko). 155 | 156 | This is not an official HashiCorp product. You may want to look into [Terraform Cloud](https://www.terraform.io/docs/cloud/) where similar feature exists. 157 | 158 | 159 | ## License 160 | 161 | This code is released under the Apache 2.0 License. Please see LICENSE for more details. 162 | 163 | Copyright © 2020 Anton Babenko (Betajob AS) -------------------------------------------------------------------------------- /assets/terraform-cost-estimation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antonbabenko/terraform-cost-estimation/5bce8cfd244c95e4c7df4056bcc6805e25302487/assets/terraform-cost-estimation.png -------------------------------------------------------------------------------- /assets/terraform-cost-estimation.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antonbabenko/terraform-cost-estimation/5bce8cfd244c95e4c7df4056bcc6805e25302487/assets/terraform-cost-estimation.psd -------------------------------------------------------------------------------- /docs/CNAME: -------------------------------------------------------------------------------- 1 | terraform-cost-estimation.com -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Terraform Cost Estimation 15 | 21 | 22 | 28 | 29 | 30 |
31 |

Terraform Cost Estimation

32 |

from Terraform plan and Terraform state.

33 |
34 |
35 |
36 | 43 | 53 | 54 | Supported formats: 55 |
  • Terraform plan as JSON (eg, plan.json): terraform plan -out=plan.tfplan && terraform show -json plan.tfplan > plan.json
  • 56 |
  • Terraform state (eg, terraform.tfstate): terraform state pull > state.json
  • 57 |
    58 |
    59 |
    60 | JSON Payload 61 | 67 | 68 |
    69 |
    70 | 73 |
    74 |
    75 |
    76 | 77 | 78 | 79 |
    80 |
    81 |
    82 |

    See github.com/antonbabenko/terraform-cost-estimation for all details about features and supported resources!

    83 |

    Like this project? Please follow @antonbabenko and share this project with your network!

    84 | 86 | 88 |

    Consider support my work on GitHub 89 | Sponsors, 90 | Buy me a coffee, or PayPal.

    92 |

    93 |

    This is not an official HashiCorp product. You may want to look into Terraform Cloud where similar feature exists. 94 |

    95 |
    96 | 97 | 98 | -------------------------------------------------------------------------------- /docs/main.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | (function (document) { 4 | const fileSelector = document.getElementById( 'file-selector' ); 5 | const label = fileSelector.nextElementSibling, 6 | labelVal = label.innerHTML; 7 | 8 | fileSelector.addEventListener( 'change', function( e ) { 9 | let fileName = e.target.value.split( '\\' ).pop(); 10 | 11 | if (fileName) { 12 | label.querySelector( 'span' ).innerHTML = fileName; 13 | } else { 14 | label.innerHTML = labelVal; 15 | } 16 | }); 17 | 18 | // Firefox bug fix 19 | fileSelector.addEventListener( 'focus', function(){ fileSelector.classList.add( 'has-focus' ); }); 20 | fileSelector.addEventListener( 'blur', function(){ fileSelector.classList.remove( 'has-focus' ); }); 21 | 22 | /////////// 23 | 24 | const fileLabel = fileSelector.nextElementSibling 25 | 26 | const payloadSelector = document.getElementById("payload") 27 | const estimateButton = document.getElementById('estimate-button') 28 | 29 | const textAreaErrorSelector = document.getElementById('request-error-selector') 30 | const mainErrorSelector = document.getElementById('main-error') 31 | 32 | const estimatedCostsSelector = document.getElementById('estimated-costs') 33 | const estimatedCostsDiffSelector = document.getElementById('estimates-costs-diff') 34 | 35 | const toDisableButton = () => { 36 | estimateButton.classList.add('disabled') 37 | estimateButton.innerHTML = 'ESTIMATING...' 38 | } 39 | 40 | const toEnableButton = () => { 41 | estimateButton.classList.remove('disabled') 42 | estimateButton.innerHTML = 'ESTIMATE' 43 | } 44 | 45 | 46 | const isValidJSONString = (string) => { 47 | try { 48 | JSON.parse(string); 49 | } catch (e) { 50 | return false 51 | } 52 | return true 53 | } 54 | 55 | const setDataIntoTag = (data) => { 56 | const hasHourlyAndMonthlyField = data.hasOwnProperty('hourly') && data.hasOwnProperty('monthly') 57 | 58 | const hasDiffHourlyAndMonthlyField = 59 | data.hasOwnProperty('diff_hourly') && data.hasOwnProperty('diff_monthly') 60 | 61 | if (hasDiffHourlyAndMonthlyField) { 62 | estimatedCostsDiffSelector.innerHTML = `Estimated cost difference: USD ${data.diff_hourly} per hour, or USD ${data.diff_monthly} per month.

    Total estimated costs: USD ${data.hourly} per hour, or USD ${data.monthly} per month.` 63 | } else if (hasHourlyAndMonthlyField) { 64 | estimatedCostsSelector.innerHTML = `Estimated costs: USD ${data.hourly} per hour, or USD ${data.monthly} per month.` 65 | } 66 | } 67 | 68 | const clearDataFromTag = () => { 69 | estimatedCostsSelector.innerHTML = '' 70 | estimatedCostsDiffSelector.innerHTML = '' 71 | } 72 | 73 | const postData = async (data = {}) => { 74 | try { 75 | const response = await fetch('https://cost.modules.tf/?from=website', { 76 | method: 'POST', 77 | mode: 'cors', 78 | headers: { 79 | 'Content-Type': 'application/json' 80 | }, 81 | body: JSON.stringify(data) 82 | }) 83 | toEnableButton() 84 | return response.json() 85 | } catch (e) { 86 | toEnableButton() 87 | mainErrorSelector.innerHTML = `Something went wrong: ${e}` 88 | console.warn('Something went wrong', e) 89 | } 90 | } 91 | 92 | fileSelector.addEventListener('change', (event) => { 93 | const fileReader = new FileReader(); 94 | fileReader.onload = function (e) { 95 | const textFromFile = e.target.result; 96 | payloadSelector.value = textFromFile; 97 | }; 98 | fileReader.readAsText(event.target.files[0], "UTF-8"); 99 | }) 100 | 101 | estimateButton.addEventListener('click', function (event) { 102 | event.preventDefault() 103 | 104 | clearDataFromTag() 105 | 106 | const payloadData = payloadSelector.value.replace(/\s+/g,'') 107 | 108 | if (!!payloadData && isValidJSONString(payloadData)) { 109 | toDisableButton() 110 | const parsedData = JSON.parse(payloadData) 111 | postData(parsedData).then(data => { 112 | if (!!data.errors) { 113 | const msg = data.errors[0] && data.errors[0].message 114 | textAreaErrorSelector.innerHTML = msg 115 | } else { 116 | fileSelector.value = '' 117 | payloadSelector.value = '' 118 | fileLabel.querySelector( 'span' ).innerHTML = 'Choose a file (json, tfstate) ...' 119 | textAreaErrorSelector.innerHTML = '' 120 | setDataIntoTag(data) 121 | } 122 | }).catch(e => { 123 | console.log(e) 124 | }) 125 | } else { 126 | textAreaErrorSelector.innerHTML = 'Please choose correct JSON file or put the content in the field' 127 | } 128 | }) 129 | })(document) 130 | -------------------------------------------------------------------------------- /docs/style.css: -------------------------------------------------------------------------------- 1 | /* reset */ 2 | html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, 3 | cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, 4 | ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, 5 | embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, 6 | time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; } 7 | input:focus, select:focus, textarea:focus {outline:none} 8 | table,td,th,tr {border-collapse:collapse; border-spacing:0;} 9 | html, body{width:100%; height:100%;} 10 | input, select, textarea,button {font-family: 'Open Sans', arial, sans-serif; font-weight:400; box-sizing: border-box; color: #000;} 11 | button,input[type="button"]{cursor: pointer} 12 | 13 | .clear{clear:both; font-size:0;} 14 | .clearfix::after{clear: both; content: ""; display: table;} 15 | 16 | 17 | 18 | /* custom-file-input */ 19 | 20 | .js .inputfile { 21 | width: 0.1px; 22 | height: 0.1px; 23 | opacity: 0; 24 | overflow: hidden; 25 | position: absolute; 26 | z-index: -1; 27 | } 28 | 29 | .inputfile + label { 30 | max-width: 80%; 31 | font-size: 16px; 32 | /* 20px */ 33 | font-weight: 600; 34 | text-overflow: ellipsis; 35 | white-space: nowrap; 36 | cursor: pointer; 37 | display: inline-block; 38 | overflow: hidden; 39 | padding: 0.625rem 1.25rem; 40 | /* 10px 20px */ 41 | } 42 | 43 | .no-js .inputfile + label { 44 | display: none; 45 | } 46 | 47 | .inputfile + label * { 48 | /* pointer-events: none; */ 49 | /* in case of FastClick lib use */ 50 | } 51 | 52 | .inputfile + label svg { 53 | width: 1em; 54 | height: 1em; 55 | vertical-align: middle; 56 | fill: currentColor; 57 | margin-top: -0.25em; 58 | /* 4px */ 59 | margin-right: 0.25em; 60 | /* 4px */ 61 | } 62 | 63 | /* style 2 */ 64 | 65 | .inputfile-2 + label { 66 | color: #d3394c; 67 | border: 1px solid #e6e6e6; 68 | border-radius: 13px; 69 | } 70 | 71 | .inputfile-2:focus + label, 72 | .inputfile-2.has-focus + label, 73 | .inputfile-2 + label:hover { 74 | color: #722040; 75 | } 76 | 77 | 78 | 79 | 80 | 81 | 82 | /*Main Styles*/ 83 | * { 84 | box-sizing: border-box; 85 | padding: 0; 86 | margin: 0; 87 | } 88 | 89 | body { 90 | background: #e6e6e6; 91 | font-size: 16px; 92 | font-family: 'Montserrat', Arial, sans-serif; 93 | font-weight: 400; 94 | padding-top: 50px; 95 | } 96 | 97 | .page-wrap { 98 | max-width: 920px; 99 | min-width: 320px; 100 | width: 100%; 101 | margin: 0 auto; 102 | background: #fff; 103 | border-radius: 10px; 104 | overflow: hidden; 105 | padding: 55px 55px 20px; 106 | } 107 | /*End Main Styles*/ 108 | 109 | /*<>*/ 110 | .page-wrap .main-title, 111 | .page-wrap .main-subtitle { 112 | text-align: center; 113 | color: #333333; 114 | } 115 | 116 | .page-wrap .main-title { 117 | font-weight: 900; 118 | font-size: 39px; 119 | line-height: 1.2; 120 | padding-bottom: 5px; 121 | } 122 | .page-wrap .main-subtitle { 123 | font-size: 18px; 124 | font-weight: 700; 125 | } 126 | /*End <<Title & Subtitle>>*/ 127 | 128 | /*<<Form>> block*/ 129 | .form-wrap { 130 | padding: 55px 0; 131 | } 132 | .form-wrap .form { 133 | 134 | } 135 | 136 | .form-wrap .custom-file-input { 137 | 138 | } 139 | .form-wrap .custom-file-input .tips { 140 | display: block; 141 | font-size: 12px; 142 | padding: 0 5px 20px; 143 | } 144 | .form-wrap .custom-file-input .tips li > span { 145 | font-weight: bold; 146 | } 147 | .form-wrap .textarea-wrap { 148 | position: relative; 149 | width: 100%; 150 | border: 1px solid #e6e6e6; 151 | border-radius: 13px; 152 | padding: 10px 30px 9px 22px; 153 | } 154 | .form-wrap .textarea-wrap .textarea-label { 155 | font-weight: 600; 156 | font-size: 10px; 157 | color: #393939; 158 | line-height: 1.5; 159 | text-transform: uppercase; 160 | } 161 | .form-wrap .textarea-wrap .textarea { 162 | outline: none; 163 | border: none; 164 | overflow: auto; 165 | resize: vertical; 166 | 167 | display: block; 168 | width: 100%; 169 | background: transparent; 170 | font-weight: 400; 171 | font-size: 15px; 172 | color: #555555; 173 | line-height: 1.2; 174 | 175 | min-height: 250px; 176 | padding-top: 9px; 177 | padding-bottom: 13px; 178 | } 179 | .form-wrap .textarea-wrap .error { 180 | position: absolute; 181 | top: calc(100% + 6px); 182 | left: 10px; 183 | font-size: 14px; 184 | color: red; 185 | font-weight: 500; 186 | } 187 | .button-wrap { 188 | margin-top: 50px; 189 | } 190 | .button-wrap .button { 191 | border: none; 192 | text-transform: uppercase; 193 | display: flex; 194 | justify-content: center; 195 | align-items: center; 196 | padding: 0 20px; 197 | width: 100%; 198 | height: 50px; 199 | background-color: #333333; 200 | border-radius: 25px; 201 | color: #ffffff; 202 | font-weight: 500; 203 | font-size: 16px; 204 | font-family: inherit; 205 | transition: background-color 0.4s; 206 | } 207 | .button-wrap .button:focus { 208 | outline: none; 209 | } 210 | .button-wrap .button:hover { 211 | background-color: #00ad5f; 212 | } 213 | .button-wrap .button.disabled { 214 | pointer-events: none; 215 | opacity: 0.5; 216 | } 217 | 218 | .form-wrap .result { 219 | padding-top: 20px; 220 | } 221 | .form-wrap .result .result-item, 222 | .form-wrap .result .result-error { 223 | display: block; 224 | font-size: 17px; 225 | font-weight: 700; 226 | } 227 | .form-wrap .result .result-error { 228 | color: red; 229 | text-align: center; 230 | } 231 | /*End <<Form>> block*/ 232 | 233 | /*<<Follow me>> block*/ 234 | .follow-me-block { 235 | border-top: 1px solid #000000; 236 | padding-top: 10px; 237 | font-size: 13px; 238 | text-align: center; 239 | } 240 | .follow-me-block .title { 241 | margin-bottom: 5px; 242 | } 243 | /*End <<Follow me>> block*/ -------------------------------------------------------------------------------- /samples/opa/terraform-cost-estimation.rego: -------------------------------------------------------------------------------- 1 | # Terraform Cost Estimation + Open Policy Agent 2 | # 3 | # This code snippet supports terraform state for now. 4 | # 5 | # Get the whole response: 6 | # opa eval --data terraform-cost-estimation.rego --input terraform.tfstate --format pretty data.terraform_cost_estimation 7 | # 8 | # Get boolean response. Return false if state (per hour) is too expensive: 9 | # opa eval --data terraform-cost-estimation.rego --input terraform.tfstate --format pretty data.terraform_cost_estimation.response.allowed 10 | 11 | package terraform_cost_estimation 12 | 13 | default max_hourly_cost = 0.05 14 | 15 | response := output { 16 | response_cost := http.send({"method": "post", "url": "https://cost.modules.tf", "headers": {"Content-type": "application/json"}, "body": input}) 17 | 18 | output := { 19 | "allowed": max_hourly_cost >= to_number(response_cost.body.hourly), 20 | "hourly": response_cost.body.hourly, 21 | "monthly": response_cost.body.monthly, 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /samples/terraform-code/.gitignore: -------------------------------------------------------------------------------- 1 | .terraform -------------------------------------------------------------------------------- /samples/terraform-code/data.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "eu-west-1" 3 | } 4 | 5 | data "aws_vpc" "default" { 6 | default = true 7 | } 8 | 9 | data "aws_subnet_ids" "all" { 10 | vpc_id = data.aws_vpc.default.id 11 | } 12 | 13 | data "aws_region" "selected" {} 14 | 15 | data "aws_availability_zones" "available" {} 16 | 17 | data "aws_ami" "amazon_linux2" { 18 | most_recent = true 19 | owners = ["137112412989"] # Amazon 20 | 21 | filter { 22 | name = "name" 23 | values = ["amzn2-ami-hvm-*"] 24 | } 25 | 26 | filter { 27 | name = "root-device-type" 28 | values = ["ebs"] 29 | } 30 | 31 | filter { 32 | name = "architecture" 33 | values = ["x86_64"] 34 | } 35 | 36 | filter { 37 | name = "virtualization-type" 38 | values = ["hvm"] 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /samples/terraform-code/main.tf: -------------------------------------------------------------------------------- 1 | // Terraform code featuring resources covered by https://github.com/antonbabenko/terraform-cost-estimation 2 | // 3 | // aws_instance 4 | // aws_ec2_fleet 5 | // aws_ebs_volume 6 | // aws_ebs_snapshot 7 | // aws_ebs_snapshot_copy 8 | 9 | // aws_autoscaling_group 10 | // aws_launch_template 11 | // aws_launch_tconfiguration 12 | 13 | // aws_lb / aws_alb 14 | // aws_elb 15 | // aws_nat_gateway 16 | 17 | ################# 18 | # EC2 instance 19 | ################# 20 | resource "aws_instance" "this_1" { 21 | ami = data.aws_ami.amazon_linux2.id #"ami-06ce3edf0cff21f07" 22 | instance_type = "t3.nano" 23 | 24 | ebs_block_device { # "standard", "gp2", "io1", "sc1", or "st1". (Default: "gp2"). 25 | device_name = "xvfs" 26 | volume_size = 10 27 | } 28 | 29 | ebs_block_device { 30 | device_name = "xvfa" 31 | volume_size = 20 32 | volume_type = "sc1" 33 | } 34 | 35 | ebs_block_device { 36 | device_name = "xvfb" 37 | volume_size = 30 38 | volume_type = "io1" 39 | iops = 2000 40 | } 41 | 42 | root_block_device { 43 | volume_type = "io1" # "standard", "gp2", "io1", "sc1", or "st1". (Default: "standard"). 44 | iops = 220 45 | } 46 | } 47 | 48 | ################# 49 | # EBS Volume - standard 50 | ################# 51 | resource "aws_ebs_volume" "volume_standard" { 52 | availability_zone = data.aws_availability_zones.available.names[0] #"eu-west-1a" 53 | size = 7 54 | type = "standard" # "gp2", "io1", "sc1" or "st1" (Default: "gp2"). 55 | } 56 | 57 | ################# 58 | # EBS Volume - io1 59 | ################# 60 | resource "aws_ebs_volume" "volume_io1" { 61 | availability_zone = data.aws_availability_zones.available.names[0] 62 | size = 8 63 | iops = 300 64 | type = "io1" 65 | } 66 | 67 | ################# 68 | # EBS Snapshot 69 | ################# 70 | resource "aws_ebs_snapshot" "standard" { 71 | volume_id = aws_ebs_volume.volume_standard.id 72 | } 73 | 74 | ################# 75 | # EBS Snapshot copy 76 | ################# 77 | resource "aws_ebs_snapshot_copy" "copied" { 78 | source_region = data.aws_region.selected.name 79 | source_snapshot_id = aws_ebs_snapshot.standard.id 80 | } 81 | 82 | ############################################## 83 | # Autoscaling group with Launch Configuration 84 | ############################################## 85 | resource "aws_autoscaling_group" "lc" { 86 | desired_capacity = 1 87 | max_size = 2 88 | min_size = 0 89 | vpc_zone_identifier = tolist(data.aws_subnet_ids.all.ids) 90 | 91 | launch_configuration = aws_launch_configuration.lc.id 92 | } 93 | 94 | resource "aws_launch_configuration" "lc" { 95 | image_id = data.aws_ami.amazon_linux2.id 96 | instance_type = "t2.micro" 97 | } 98 | 99 | ######################################### 100 | # Autoscaling group with Launch Template 101 | ######################################### 102 | resource "aws_autoscaling_group" "lt" { 103 | desired_capacity = 1 104 | max_size = 2 105 | min_size = 0 106 | vpc_zone_identifier = tolist(data.aws_subnet_ids.all.ids) 107 | 108 | launch_template { 109 | id = aws_launch_template.lt.id 110 | version = "$Latest" 111 | } 112 | } 113 | 114 | ######################################### 115 | # EC2 fleet with Launch Template 116 | ######################################### 117 | resource "aws_ec2_fleet" "lt" { 118 | launch_template_config { 119 | launch_template_specification { 120 | launch_template_id = aws_launch_template.lt.id 121 | version = aws_launch_template.lt.latest_version 122 | } 123 | // // For internal tests 124 | // launch_template_specification { 125 | // launch_template_id = element(aws_launch_template.lt.*.id, 0) 126 | // version = aws_launch_template.lt[0].latest_version 127 | // } 128 | } 129 | 130 | target_capacity_specification { 131 | default_target_capacity_type = "on-demand" 132 | total_target_capacity = 1 133 | } 134 | } 135 | 136 | resource "aws_launch_template" "lt" { 137 | image_id = data.aws_ami.amazon_linux2.id 138 | instance_type = "t2.nano" 139 | 140 | elastic_gpu_specifications { 141 | type = "eg1.medium" 142 | } 143 | 144 | elastic_gpu_specifications { 145 | type = "eg1.large" 146 | } 147 | 148 | elastic_inference_accelerator { // this is not part of EC2 pricing 149 | type = "eia1.medium" 150 | } 151 | 152 | block_device_mappings { # "standard", "gp2", "io1", "sc1", or "st1". (Default: "gp2"). 153 | device_name = "xvfs" 154 | 155 | ebs { 156 | volume_size = 11 157 | } 158 | } 159 | 160 | block_device_mappings { # "standard", "gp2", "io1", "sc1", or "st1". (Default: "gp2"). 161 | device_name = "xvfa" 162 | 163 | ebs { 164 | volume_size = 21 165 | volume_type = "sc1" 166 | } 167 | } 168 | 169 | block_device_mappings { # "standard", "gp2", "io1", "sc1", or "st1". (Default: "gp2"). 170 | device_name = "xvfb" 171 | 172 | ebs { 173 | volume_size = 31 174 | volume_type = "io1" 175 | iops = 2001 176 | } 177 | } 178 | } 179 | 180 | ######################################### 181 | # Application and Network Load Balancers 182 | ######################################### 183 | resource "aws_alb" "alb" { 184 | load_balancer_type = "application" 185 | subnets = data.aws_subnet_ids.all.ids 186 | } 187 | 188 | resource "aws_lb" "nlb" { 189 | load_balancer_type = "network" 190 | subnets = data.aws_subnet_ids.all.ids 191 | } 192 | 193 | ########################## 194 | # ELB 195 | ########################## 196 | resource "aws_elb" "elb" { 197 | listener { 198 | instance_port = 80 199 | instance_protocol = "HTTP" 200 | lb_port = 80 201 | lb_protocol = "HTTP" 202 | } 203 | 204 | subnets = data.aws_subnet_ids.all.ids 205 | } 206 | 207 | ########################## 208 | # NAT Gateway 209 | ########################## 210 | resource "aws_eip" "nat" { 211 | vpc = true 212 | } 213 | 214 | resource "aws_nat_gateway" "nat" { 215 | allocation_id = aws_eip.nat.id 216 | subnet_id = tolist(data.aws_subnet_ids.all.ids)[0] 217 | } 218 | -------------------------------------------------------------------------------- /samples/terraform-code/plan.json: -------------------------------------------------------------------------------- 1 | { 2 | "format_version": "0.1", 3 | "terraform_version": "0.12.25", 4 | "planned_values": { 5 | "root_module": { 6 | "resources": [ 7 | { 8 | "address": "aws_alb.alb", 9 | "mode": "managed", 10 | "type": "aws_alb", 11 | "name": "alb", 12 | "provider_name": "aws", 13 | "schema_version": 0, 14 | "values": { 15 | "access_logs": [], 16 | "drop_invalid_header_fields": false, 17 | "enable_cross_zone_load_balancing": null, 18 | "enable_deletion_protection": false, 19 | "enable_http2": true, 20 | "idle_timeout": 60, 21 | "load_balancer_type": "application", 22 | "name_prefix": null, 23 | "subnets": [ 24 | "subnet-816551c9", 25 | "subnet-8f2442d5", 26 | "subnet-e3f0d585" 27 | ], 28 | "tags": null, 29 | "timeouts": null 30 | } 31 | }, 32 | { 33 | "address": "aws_autoscaling_group.lc", 34 | "mode": "managed", 35 | "type": "aws_autoscaling_group", 36 | "name": "lc", 37 | "provider_name": "aws", 38 | "schema_version": 0, 39 | "values": { 40 | "desired_capacity": 1, 41 | "enabled_metrics": null, 42 | "force_delete": false, 43 | "health_check_grace_period": 300, 44 | "initial_lifecycle_hook": [], 45 | "launch_template": [], 46 | "max_instance_lifetime": null, 47 | "max_size": 2, 48 | "metrics_granularity": "1Minute", 49 | "min_elb_capacity": null, 50 | "min_size": 0, 51 | "mixed_instances_policy": [], 52 | "name_prefix": null, 53 | "placement_group": null, 54 | "protect_from_scale_in": false, 55 | "suspended_processes": null, 56 | "tag": [], 57 | "tags": null, 58 | "termination_policies": null, 59 | "timeouts": null, 60 | "vpc_zone_identifier": [ 61 | "subnet-816551c9", 62 | "subnet-8f2442d5", 63 | "subnet-e3f0d585" 64 | ], 65 | "wait_for_capacity_timeout": "10m", 66 | "wait_for_elb_capacity": null 67 | } 68 | }, 69 | { 70 | "address": "aws_autoscaling_group.lt", 71 | "mode": "managed", 72 | "type": "aws_autoscaling_group", 73 | "name": "lt", 74 | "provider_name": "aws", 75 | "schema_version": 0, 76 | "values": { 77 | "desired_capacity": 1, 78 | "enabled_metrics": null, 79 | "force_delete": false, 80 | "health_check_grace_period": 300, 81 | "initial_lifecycle_hook": [], 82 | "launch_configuration": null, 83 | "launch_template": [ 84 | { 85 | "version": "$Latest" 86 | } 87 | ], 88 | "max_instance_lifetime": null, 89 | "max_size": 2, 90 | "metrics_granularity": "1Minute", 91 | "min_elb_capacity": null, 92 | "min_size": 0, 93 | "mixed_instances_policy": [], 94 | "name_prefix": null, 95 | "placement_group": null, 96 | "protect_from_scale_in": false, 97 | "suspended_processes": null, 98 | "tag": [], 99 | "tags": null, 100 | "termination_policies": null, 101 | "timeouts": null, 102 | "vpc_zone_identifier": [ 103 | "subnet-816551c9", 104 | "subnet-8f2442d5", 105 | "subnet-e3f0d585" 106 | ], 107 | "wait_for_capacity_timeout": "10m", 108 | "wait_for_elb_capacity": null 109 | } 110 | }, 111 | { 112 | "address": "aws_ebs_snapshot.standard", 113 | "mode": "managed", 114 | "type": "aws_ebs_snapshot", 115 | "name": "standard", 116 | "provider_name": "aws", 117 | "schema_version": 0, 118 | "values": { 119 | "description": null, 120 | "tags": null, 121 | "timeouts": null 122 | } 123 | }, 124 | { 125 | "address": "aws_ebs_snapshot_copy.copied", 126 | "mode": "managed", 127 | "type": "aws_ebs_snapshot_copy", 128 | "name": "copied", 129 | "provider_name": "aws", 130 | "schema_version": 0, 131 | "values": { 132 | "description": null, 133 | "encrypted": null, 134 | "kms_key_id": null, 135 | "source_region": "eu-west-1", 136 | "tags": null 137 | } 138 | }, 139 | { 140 | "address": "aws_ebs_volume.volume_io1", 141 | "mode": "managed", 142 | "type": "aws_ebs_volume", 143 | "name": "volume_io1", 144 | "provider_name": "aws", 145 | "schema_version": 0, 146 | "values": { 147 | "availability_zone": "eu-west-1a", 148 | "iops": 300, 149 | "multi_attach_enabled": null, 150 | "outpost_arn": null, 151 | "size": 8, 152 | "tags": null, 153 | "type": "io1" 154 | } 155 | }, 156 | { 157 | "address": "aws_ebs_volume.volume_standard", 158 | "mode": "managed", 159 | "type": "aws_ebs_volume", 160 | "name": "volume_standard", 161 | "provider_name": "aws", 162 | "schema_version": 0, 163 | "values": { 164 | "availability_zone": "eu-west-1a", 165 | "multi_attach_enabled": null, 166 | "outpost_arn": null, 167 | "size": 7, 168 | "tags": null, 169 | "type": "standard" 170 | } 171 | }, 172 | { 173 | "address": "aws_ec2_fleet.lt", 174 | "mode": "managed", 175 | "type": "aws_ec2_fleet", 176 | "name": "lt", 177 | "provider_name": "aws", 178 | "schema_version": 0, 179 | "values": { 180 | "excess_capacity_termination_policy": "termination", 181 | "launch_template_config": [ 182 | { 183 | "launch_template_specification": [ 184 | { 185 | "launch_template_name": null 186 | } 187 | ], 188 | "override": [] 189 | } 190 | ], 191 | "on_demand_options": [], 192 | "replace_unhealthy_instances": null, 193 | "spot_options": [], 194 | "tags": null, 195 | "target_capacity_specification": [ 196 | { 197 | "default_target_capacity_type": "on-demand", 198 | "on_demand_target_capacity": null, 199 | "spot_target_capacity": null, 200 | "total_target_capacity": 1 201 | } 202 | ], 203 | "terminate_instances": false, 204 | "terminate_instances_with_expiration": null, 205 | "timeouts": null, 206 | "type": "maintain" 207 | } 208 | }, 209 | { 210 | "address": "aws_eip.nat", 211 | "mode": "managed", 212 | "type": "aws_eip", 213 | "name": "nat", 214 | "provider_name": "aws", 215 | "schema_version": 0, 216 | "values": { 217 | "associate_with_private_ip": null, 218 | "customer_owned_ipv4_pool": null, 219 | "tags": null, 220 | "timeouts": null, 221 | "vpc": true 222 | } 223 | }, 224 | { 225 | "address": "aws_elb.elb", 226 | "mode": "managed", 227 | "type": "aws_elb", 228 | "name": "elb", 229 | "provider_name": "aws", 230 | "schema_version": 0, 231 | "values": { 232 | "access_logs": [], 233 | "connection_draining": false, 234 | "connection_draining_timeout": 300, 235 | "cross_zone_load_balancing": true, 236 | "idle_timeout": 60, 237 | "listener": [ 238 | { 239 | "instance_port": 80, 240 | "instance_protocol": "HTTP", 241 | "lb_port": 80, 242 | "lb_protocol": "HTTP", 243 | "ssl_certificate_id": "" 244 | } 245 | ], 246 | "name_prefix": null, 247 | "subnets": [ 248 | "subnet-816551c9", 249 | "subnet-8f2442d5", 250 | "subnet-e3f0d585" 251 | ], 252 | "tags": null 253 | } 254 | }, 255 | { 256 | "address": "aws_instance.this_1", 257 | "mode": "managed", 258 | "type": "aws_instance", 259 | "name": "this_1", 260 | "provider_name": "aws", 261 | "schema_version": 1, 262 | "values": { 263 | "ami": "ami-06ce3edf0cff21f07", 264 | "credit_specification": [], 265 | "disable_api_termination": null, 266 | "ebs_block_device": [ 267 | { 268 | "delete_on_termination": true, 269 | "device_name": "xvfa", 270 | "volume_size": 20, 271 | "volume_type": "sc1" 272 | }, 273 | { 274 | "delete_on_termination": true, 275 | "device_name": "xvfb", 276 | "iops": 2000, 277 | "volume_size": 30, 278 | "volume_type": "io1" 279 | }, 280 | { 281 | "delete_on_termination": true, 282 | "device_name": "xvfs", 283 | "volume_size": 10 284 | } 285 | ], 286 | "ebs_optimized": null, 287 | "get_password_data": false, 288 | "hibernation": null, 289 | "iam_instance_profile": null, 290 | "instance_initiated_shutdown_behavior": null, 291 | "instance_type": "t3.nano", 292 | "monitoring": null, 293 | "root_block_device": [ 294 | { 295 | "delete_on_termination": true, 296 | "iops": 220, 297 | "volume_type": "io1" 298 | } 299 | ], 300 | "source_dest_check": true, 301 | "tags": null, 302 | "timeouts": null, 303 | "user_data": null, 304 | "user_data_base64": null 305 | } 306 | }, 307 | { 308 | "address": "aws_launch_configuration.lc", 309 | "mode": "managed", 310 | "type": "aws_launch_configuration", 311 | "name": "lc", 312 | "provider_name": "aws", 313 | "schema_version": 0, 314 | "values": { 315 | "associate_public_ip_address": false, 316 | "enable_monitoring": true, 317 | "ephemeral_block_device": [], 318 | "iam_instance_profile": null, 319 | "image_id": "ami-06ce3edf0cff21f07", 320 | "instance_type": "t2.micro", 321 | "name_prefix": null, 322 | "placement_tenancy": null, 323 | "security_groups": null, 324 | "spot_price": null, 325 | "user_data": null, 326 | "user_data_base64": null, 327 | "vpc_classic_link_id": null, 328 | "vpc_classic_link_security_groups": null 329 | } 330 | }, 331 | { 332 | "address": "aws_launch_template.lt", 333 | "mode": "managed", 334 | "type": "aws_launch_template", 335 | "name": "lt", 336 | "provider_name": "aws", 337 | "schema_version": 0, 338 | "values": { 339 | "block_device_mappings": [ 340 | { 341 | "device_name": "xvfs", 342 | "ebs": [ 343 | { 344 | "delete_on_termination": null, 345 | "encrypted": null, 346 | "kms_key_id": null, 347 | "snapshot_id": null, 348 | "volume_size": 11 349 | } 350 | ], 351 | "no_device": null, 352 | "virtual_name": null 353 | }, 354 | { 355 | "device_name": "xvfa", 356 | "ebs": [ 357 | { 358 | "delete_on_termination": null, 359 | "encrypted": null, 360 | "kms_key_id": null, 361 | "snapshot_id": null, 362 | "volume_size": 21, 363 | "volume_type": "sc1" 364 | } 365 | ], 366 | "no_device": null, 367 | "virtual_name": null 368 | }, 369 | { 370 | "device_name": "xvfb", 371 | "ebs": [ 372 | { 373 | "delete_on_termination": null, 374 | "encrypted": null, 375 | "iops": 2001, 376 | "kms_key_id": null, 377 | "snapshot_id": null, 378 | "volume_size": 31, 379 | "volume_type": "io1" 380 | } 381 | ], 382 | "no_device": null, 383 | "virtual_name": null 384 | } 385 | ], 386 | "capacity_reservation_specification": [], 387 | "cpu_options": [], 388 | "credit_specification": [], 389 | "description": null, 390 | "disable_api_termination": null, 391 | "ebs_optimized": null, 392 | "elastic_gpu_specifications": [ 393 | { 394 | "type": "eg1.medium" 395 | }, 396 | { 397 | "type": "eg1.large" 398 | } 399 | ], 400 | "elastic_inference_accelerator": [ 401 | { 402 | "type": "eia1.medium" 403 | } 404 | ], 405 | "hibernation_options": [], 406 | "iam_instance_profile": [], 407 | "image_id": "ami-06ce3edf0cff21f07", 408 | "instance_initiated_shutdown_behavior": null, 409 | "instance_market_options": [], 410 | "instance_type": "t2.nano", 411 | "kernel_id": null, 412 | "key_name": null, 413 | "license_specification": [], 414 | "monitoring": [], 415 | "name_prefix": null, 416 | "network_interfaces": [], 417 | "placement": [], 418 | "ram_disk_id": null, 419 | "security_group_names": null, 420 | "tag_specifications": [], 421 | "tags": null, 422 | "user_data": null, 423 | "vpc_security_group_ids": null 424 | } 425 | }, 426 | { 427 | "address": "aws_lb.nlb", 428 | "mode": "managed", 429 | "type": "aws_lb", 430 | "name": "nlb", 431 | "provider_name": "aws", 432 | "schema_version": 0, 433 | "values": { 434 | "access_logs": [], 435 | "drop_invalid_header_fields": null, 436 | "enable_cross_zone_load_balancing": false, 437 | "enable_deletion_protection": false, 438 | "enable_http2": null, 439 | "idle_timeout": null, 440 | "load_balancer_type": "network", 441 | "name_prefix": null, 442 | "subnets": [ 443 | "subnet-816551c9", 444 | "subnet-8f2442d5", 445 | "subnet-e3f0d585" 446 | ], 447 | "tags": null, 448 | "timeouts": null 449 | } 450 | }, 451 | { 452 | "address": "aws_nat_gateway.nat", 453 | "mode": "managed", 454 | "type": "aws_nat_gateway", 455 | "name": "nat", 456 | "provider_name": "aws", 457 | "schema_version": 0, 458 | "values": { 459 | "subnet_id": "subnet-816551c9", 460 | "tags": null 461 | } 462 | } 463 | ] 464 | } 465 | }, 466 | "resource_changes": [ 467 | { 468 | "address": "aws_alb.alb", 469 | "mode": "managed", 470 | "type": "aws_alb", 471 | "name": "alb", 472 | "provider_name": "aws", 473 | "change": { 474 | "actions": [ 475 | "create" 476 | ], 477 | "before": null, 478 | "after": { 479 | "access_logs": [], 480 | "drop_invalid_header_fields": false, 481 | "enable_cross_zone_load_balancing": null, 482 | "enable_deletion_protection": false, 483 | "enable_http2": true, 484 | "idle_timeout": 60, 485 | "load_balancer_type": "application", 486 | "name_prefix": null, 487 | "subnets": [ 488 | "subnet-816551c9", 489 | "subnet-8f2442d5", 490 | "subnet-e3f0d585" 491 | ], 492 | "tags": null, 493 | "timeouts": null 494 | }, 495 | "after_unknown": { 496 | "access_logs": [], 497 | "arn": true, 498 | "arn_suffix": true, 499 | "dns_name": true, 500 | "id": true, 501 | "internal": true, 502 | "ip_address_type": true, 503 | "name": true, 504 | "security_groups": true, 505 | "subnet_mapping": true, 506 | "subnets": [ 507 | false, 508 | false, 509 | false 510 | ], 511 | "vpc_id": true, 512 | "zone_id": true 513 | } 514 | } 515 | }, 516 | { 517 | "address": "aws_autoscaling_group.lc", 518 | "mode": "managed", 519 | "type": "aws_autoscaling_group", 520 | "name": "lc", 521 | "provider_name": "aws", 522 | "change": { 523 | "actions": [ 524 | "create" 525 | ], 526 | "before": null, 527 | "after": { 528 | "desired_capacity": 1, 529 | "enabled_metrics": null, 530 | "force_delete": false, 531 | "health_check_grace_period": 300, 532 | "initial_lifecycle_hook": [], 533 | "launch_template": [], 534 | "max_instance_lifetime": null, 535 | "max_size": 2, 536 | "metrics_granularity": "1Minute", 537 | "min_elb_capacity": null, 538 | "min_size": 0, 539 | "mixed_instances_policy": [], 540 | "name_prefix": null, 541 | "placement_group": null, 542 | "protect_from_scale_in": false, 543 | "suspended_processes": null, 544 | "tag": [], 545 | "tags": null, 546 | "termination_policies": null, 547 | "timeouts": null, 548 | "vpc_zone_identifier": [ 549 | "subnet-816551c9", 550 | "subnet-8f2442d5", 551 | "subnet-e3f0d585" 552 | ], 553 | "wait_for_capacity_timeout": "10m", 554 | "wait_for_elb_capacity": null 555 | }, 556 | "after_unknown": { 557 | "arn": true, 558 | "availability_zones": true, 559 | "default_cooldown": true, 560 | "health_check_type": true, 561 | "id": true, 562 | "initial_lifecycle_hook": [], 563 | "launch_configuration": true, 564 | "launch_template": [], 565 | "load_balancers": true, 566 | "mixed_instances_policy": [], 567 | "name": true, 568 | "service_linked_role_arn": true, 569 | "tag": [], 570 | "target_group_arns": true, 571 | "vpc_zone_identifier": [ 572 | false, 573 | false, 574 | false 575 | ] 576 | } 577 | } 578 | }, 579 | { 580 | "address": "aws_autoscaling_group.lt", 581 | "mode": "managed", 582 | "type": "aws_autoscaling_group", 583 | "name": "lt", 584 | "provider_name": "aws", 585 | "change": { 586 | "actions": [ 587 | "create" 588 | ], 589 | "before": null, 590 | "after": { 591 | "desired_capacity": 1, 592 | "enabled_metrics": null, 593 | "force_delete": false, 594 | "health_check_grace_period": 300, 595 | "initial_lifecycle_hook": [], 596 | "launch_configuration": null, 597 | "launch_template": [ 598 | { 599 | "version": "$Latest" 600 | } 601 | ], 602 | "max_instance_lifetime": null, 603 | "max_size": 2, 604 | "metrics_granularity": "1Minute", 605 | "min_elb_capacity": null, 606 | "min_size": 0, 607 | "mixed_instances_policy": [], 608 | "name_prefix": null, 609 | "placement_group": null, 610 | "protect_from_scale_in": false, 611 | "suspended_processes": null, 612 | "tag": [], 613 | "tags": null, 614 | "termination_policies": null, 615 | "timeouts": null, 616 | "vpc_zone_identifier": [ 617 | "subnet-816551c9", 618 | "subnet-8f2442d5", 619 | "subnet-e3f0d585" 620 | ], 621 | "wait_for_capacity_timeout": "10m", 622 | "wait_for_elb_capacity": null 623 | }, 624 | "after_unknown": { 625 | "arn": true, 626 | "availability_zones": true, 627 | "default_cooldown": true, 628 | "health_check_type": true, 629 | "id": true, 630 | "initial_lifecycle_hook": [], 631 | "launch_template": [ 632 | { 633 | "id": true, 634 | "name": true 635 | } 636 | ], 637 | "load_balancers": true, 638 | "mixed_instances_policy": [], 639 | "name": true, 640 | "service_linked_role_arn": true, 641 | "tag": [], 642 | "target_group_arns": true, 643 | "vpc_zone_identifier": [ 644 | false, 645 | false, 646 | false 647 | ] 648 | } 649 | } 650 | }, 651 | { 652 | "address": "aws_ebs_snapshot.standard", 653 | "mode": "managed", 654 | "type": "aws_ebs_snapshot", 655 | "name": "standard", 656 | "provider_name": "aws", 657 | "change": { 658 | "actions": [ 659 | "create" 660 | ], 661 | "before": null, 662 | "after": { 663 | "description": null, 664 | "tags": null, 665 | "timeouts": null 666 | }, 667 | "after_unknown": { 668 | "data_encryption_key_id": true, 669 | "encrypted": true, 670 | "id": true, 671 | "kms_key_id": true, 672 | "owner_alias": true, 673 | "owner_id": true, 674 | "volume_id": true, 675 | "volume_size": true 676 | } 677 | } 678 | }, 679 | { 680 | "address": "aws_ebs_snapshot_copy.copied", 681 | "mode": "managed", 682 | "type": "aws_ebs_snapshot_copy", 683 | "name": "copied", 684 | "provider_name": "aws", 685 | "change": { 686 | "actions": [ 687 | "create" 688 | ], 689 | "before": null, 690 | "after": { 691 | "description": null, 692 | "encrypted": null, 693 | "kms_key_id": null, 694 | "source_region": "eu-west-1", 695 | "tags": null 696 | }, 697 | "after_unknown": { 698 | "data_encryption_key_id": true, 699 | "id": true, 700 | "owner_alias": true, 701 | "owner_id": true, 702 | "source_snapshot_id": true, 703 | "volume_id": true, 704 | "volume_size": true 705 | } 706 | } 707 | }, 708 | { 709 | "address": "aws_ebs_volume.volume_io1", 710 | "mode": "managed", 711 | "type": "aws_ebs_volume", 712 | "name": "volume_io1", 713 | "provider_name": "aws", 714 | "change": { 715 | "actions": [ 716 | "create" 717 | ], 718 | "before": null, 719 | "after": { 720 | "availability_zone": "eu-west-1a", 721 | "iops": 300, 722 | "multi_attach_enabled": null, 723 | "outpost_arn": null, 724 | "size": 8, 725 | "tags": null, 726 | "type": "io1" 727 | }, 728 | "after_unknown": { 729 | "arn": true, 730 | "encrypted": true, 731 | "id": true, 732 | "kms_key_id": true, 733 | "snapshot_id": true 734 | } 735 | } 736 | }, 737 | { 738 | "address": "aws_ebs_volume.volume_standard", 739 | "mode": "managed", 740 | "type": "aws_ebs_volume", 741 | "name": "volume_standard", 742 | "provider_name": "aws", 743 | "change": { 744 | "actions": [ 745 | "create" 746 | ], 747 | "before": null, 748 | "after": { 749 | "availability_zone": "eu-west-1a", 750 | "multi_attach_enabled": null, 751 | "outpost_arn": null, 752 | "size": 7, 753 | "tags": null, 754 | "type": "standard" 755 | }, 756 | "after_unknown": { 757 | "arn": true, 758 | "encrypted": true, 759 | "id": true, 760 | "iops": true, 761 | "kms_key_id": true, 762 | "snapshot_id": true 763 | } 764 | } 765 | }, 766 | { 767 | "address": "aws_ec2_fleet.lt", 768 | "mode": "managed", 769 | "type": "aws_ec2_fleet", 770 | "name": "lt", 771 | "provider_name": "aws", 772 | "change": { 773 | "actions": [ 774 | "create" 775 | ], 776 | "before": null, 777 | "after": { 778 | "excess_capacity_termination_policy": "termination", 779 | "launch_template_config": [ 780 | { 781 | "launch_template_specification": [ 782 | { 783 | "launch_template_name": null 784 | } 785 | ], 786 | "override": [] 787 | } 788 | ], 789 | "on_demand_options": [], 790 | "replace_unhealthy_instances": null, 791 | "spot_options": [], 792 | "tags": null, 793 | "target_capacity_specification": [ 794 | { 795 | "default_target_capacity_type": "on-demand", 796 | "on_demand_target_capacity": null, 797 | "spot_target_capacity": null, 798 | "total_target_capacity": 1 799 | } 800 | ], 801 | "terminate_instances": false, 802 | "terminate_instances_with_expiration": null, 803 | "timeouts": null, 804 | "type": "maintain" 805 | }, 806 | "after_unknown": { 807 | "id": true, 808 | "launch_template_config": [ 809 | { 810 | "launch_template_specification": [ 811 | { 812 | "launch_template_id": true, 813 | "version": true 814 | } 815 | ], 816 | "override": [] 817 | } 818 | ], 819 | "on_demand_options": [], 820 | "spot_options": [], 821 | "target_capacity_specification": [ 822 | {} 823 | ] 824 | } 825 | } 826 | }, 827 | { 828 | "address": "aws_eip.nat", 829 | "mode": "managed", 830 | "type": "aws_eip", 831 | "name": "nat", 832 | "provider_name": "aws", 833 | "change": { 834 | "actions": [ 835 | "create" 836 | ], 837 | "before": null, 838 | "after": { 839 | "associate_with_private_ip": null, 840 | "customer_owned_ipv4_pool": null, 841 | "tags": null, 842 | "timeouts": null, 843 | "vpc": true 844 | }, 845 | "after_unknown": { 846 | "allocation_id": true, 847 | "association_id": true, 848 | "customer_owned_ip": true, 849 | "domain": true, 850 | "id": true, 851 | "instance": true, 852 | "network_interface": true, 853 | "private_dns": true, 854 | "private_ip": true, 855 | "public_dns": true, 856 | "public_ip": true, 857 | "public_ipv4_pool": true 858 | } 859 | } 860 | }, 861 | { 862 | "address": "aws_elb.elb", 863 | "mode": "managed", 864 | "type": "aws_elb", 865 | "name": "elb", 866 | "provider_name": "aws", 867 | "change": { 868 | "actions": [ 869 | "create" 870 | ], 871 | "before": null, 872 | "after": { 873 | "access_logs": [], 874 | "connection_draining": false, 875 | "connection_draining_timeout": 300, 876 | "cross_zone_load_balancing": true, 877 | "idle_timeout": 60, 878 | "listener": [ 879 | { 880 | "instance_port": 80, 881 | "instance_protocol": "HTTP", 882 | "lb_port": 80, 883 | "lb_protocol": "HTTP", 884 | "ssl_certificate_id": "" 885 | } 886 | ], 887 | "name_prefix": null, 888 | "subnets": [ 889 | "subnet-816551c9", 890 | "subnet-8f2442d5", 891 | "subnet-e3f0d585" 892 | ], 893 | "tags": null 894 | }, 895 | "after_unknown": { 896 | "access_logs": [], 897 | "arn": true, 898 | "availability_zones": true, 899 | "dns_name": true, 900 | "health_check": true, 901 | "id": true, 902 | "instances": true, 903 | "internal": true, 904 | "listener": [ 905 | {} 906 | ], 907 | "name": true, 908 | "security_groups": true, 909 | "source_security_group": true, 910 | "source_security_group_id": true, 911 | "subnets": [ 912 | false, 913 | false, 914 | false 915 | ], 916 | "zone_id": true 917 | } 918 | } 919 | }, 920 | { 921 | "address": "aws_instance.this_1", 922 | "mode": "managed", 923 | "type": "aws_instance", 924 | "name": "this_1", 925 | "provider_name": "aws", 926 | "change": { 927 | "actions": [ 928 | "create" 929 | ], 930 | "before": null, 931 | "after": { 932 | "ami": "ami-06ce3edf0cff21f07", 933 | "credit_specification": [], 934 | "disable_api_termination": null, 935 | "ebs_block_device": [ 936 | { 937 | "delete_on_termination": true, 938 | "device_name": "xvfa", 939 | "volume_size": 20, 940 | "volume_type": "sc1" 941 | }, 942 | { 943 | "delete_on_termination": true, 944 | "device_name": "xvfb", 945 | "iops": 2000, 946 | "volume_size": 30, 947 | "volume_type": "io1" 948 | }, 949 | { 950 | "delete_on_termination": true, 951 | "device_name": "xvfs", 952 | "volume_size": 10 953 | } 954 | ], 955 | "ebs_optimized": null, 956 | "get_password_data": false, 957 | "hibernation": null, 958 | "iam_instance_profile": null, 959 | "instance_initiated_shutdown_behavior": null, 960 | "instance_type": "t3.nano", 961 | "monitoring": null, 962 | "root_block_device": [ 963 | { 964 | "delete_on_termination": true, 965 | "iops": 220, 966 | "volume_type": "io1" 967 | } 968 | ], 969 | "source_dest_check": true, 970 | "tags": null, 971 | "timeouts": null, 972 | "user_data": null, 973 | "user_data_base64": null 974 | }, 975 | "after_unknown": { 976 | "arn": true, 977 | "associate_public_ip_address": true, 978 | "availability_zone": true, 979 | "cpu_core_count": true, 980 | "cpu_threads_per_core": true, 981 | "credit_specification": [], 982 | "ebs_block_device": [ 983 | { 984 | "encrypted": true, 985 | "iops": true, 986 | "kms_key_id": true, 987 | "snapshot_id": true, 988 | "volume_id": true 989 | }, 990 | { 991 | "encrypted": true, 992 | "kms_key_id": true, 993 | "snapshot_id": true, 994 | "volume_id": true 995 | }, 996 | { 997 | "encrypted": true, 998 | "iops": true, 999 | "kms_key_id": true, 1000 | "snapshot_id": true, 1001 | "volume_id": true, 1002 | "volume_type": true 1003 | } 1004 | ], 1005 | "ephemeral_block_device": true, 1006 | "host_id": true, 1007 | "id": true, 1008 | "instance_state": true, 1009 | "ipv6_address_count": true, 1010 | "ipv6_addresses": true, 1011 | "key_name": true, 1012 | "metadata_options": true, 1013 | "network_interface": true, 1014 | "network_interface_id": true, 1015 | "outpost_arn": true, 1016 | "password_data": true, 1017 | "placement_group": true, 1018 | "primary_network_interface_id": true, 1019 | "private_dns": true, 1020 | "private_ip": true, 1021 | "public_dns": true, 1022 | "public_ip": true, 1023 | "root_block_device": [ 1024 | { 1025 | "device_name": true, 1026 | "encrypted": true, 1027 | "kms_key_id": true, 1028 | "volume_id": true, 1029 | "volume_size": true 1030 | } 1031 | ], 1032 | "security_groups": true, 1033 | "subnet_id": true, 1034 | "tenancy": true, 1035 | "volume_tags": true, 1036 | "vpc_security_group_ids": true 1037 | } 1038 | } 1039 | }, 1040 | { 1041 | "address": "aws_launch_configuration.lc", 1042 | "mode": "managed", 1043 | "type": "aws_launch_configuration", 1044 | "name": "lc", 1045 | "provider_name": "aws", 1046 | "change": { 1047 | "actions": [ 1048 | "create" 1049 | ], 1050 | "before": null, 1051 | "after": { 1052 | "associate_public_ip_address": false, 1053 | "enable_monitoring": true, 1054 | "ephemeral_block_device": [], 1055 | "iam_instance_profile": null, 1056 | "image_id": "ami-06ce3edf0cff21f07", 1057 | "instance_type": "t2.micro", 1058 | "name_prefix": null, 1059 | "placement_tenancy": null, 1060 | "security_groups": null, 1061 | "spot_price": null, 1062 | "user_data": null, 1063 | "user_data_base64": null, 1064 | "vpc_classic_link_id": null, 1065 | "vpc_classic_link_security_groups": null 1066 | }, 1067 | "after_unknown": { 1068 | "arn": true, 1069 | "ebs_block_device": true, 1070 | "ebs_optimized": true, 1071 | "ephemeral_block_device": [], 1072 | "id": true, 1073 | "key_name": true, 1074 | "name": true, 1075 | "root_block_device": true 1076 | } 1077 | } 1078 | }, 1079 | { 1080 | "address": "aws_launch_template.lt", 1081 | "mode": "managed", 1082 | "type": "aws_launch_template", 1083 | "name": "lt", 1084 | "provider_name": "aws", 1085 | "change": { 1086 | "actions": [ 1087 | "create" 1088 | ], 1089 | "before": null, 1090 | "after": { 1091 | "block_device_mappings": [ 1092 | { 1093 | "device_name": "xvfs", 1094 | "ebs": [ 1095 | { 1096 | "delete_on_termination": null, 1097 | "encrypted": null, 1098 | "kms_key_id": null, 1099 | "snapshot_id": null, 1100 | "volume_size": 11 1101 | } 1102 | ], 1103 | "no_device": null, 1104 | "virtual_name": null 1105 | }, 1106 | { 1107 | "device_name": "xvfa", 1108 | "ebs": [ 1109 | { 1110 | "delete_on_termination": null, 1111 | "encrypted": null, 1112 | "kms_key_id": null, 1113 | "snapshot_id": null, 1114 | "volume_size": 21, 1115 | "volume_type": "sc1" 1116 | } 1117 | ], 1118 | "no_device": null, 1119 | "virtual_name": null 1120 | }, 1121 | { 1122 | "device_name": "xvfb", 1123 | "ebs": [ 1124 | { 1125 | "delete_on_termination": null, 1126 | "encrypted": null, 1127 | "iops": 2001, 1128 | "kms_key_id": null, 1129 | "snapshot_id": null, 1130 | "volume_size": 31, 1131 | "volume_type": "io1" 1132 | } 1133 | ], 1134 | "no_device": null, 1135 | "virtual_name": null 1136 | } 1137 | ], 1138 | "capacity_reservation_specification": [], 1139 | "cpu_options": [], 1140 | "credit_specification": [], 1141 | "description": null, 1142 | "disable_api_termination": null, 1143 | "ebs_optimized": null, 1144 | "elastic_gpu_specifications": [ 1145 | { 1146 | "type": "eg1.medium" 1147 | }, 1148 | { 1149 | "type": "eg1.large" 1150 | } 1151 | ], 1152 | "elastic_inference_accelerator": [ 1153 | { 1154 | "type": "eia1.medium" 1155 | } 1156 | ], 1157 | "hibernation_options": [], 1158 | "iam_instance_profile": [], 1159 | "image_id": "ami-06ce3edf0cff21f07", 1160 | "instance_initiated_shutdown_behavior": null, 1161 | "instance_market_options": [], 1162 | "instance_type": "t2.nano", 1163 | "kernel_id": null, 1164 | "key_name": null, 1165 | "license_specification": [], 1166 | "monitoring": [], 1167 | "name_prefix": null, 1168 | "network_interfaces": [], 1169 | "placement": [], 1170 | "ram_disk_id": null, 1171 | "security_group_names": null, 1172 | "tag_specifications": [], 1173 | "tags": null, 1174 | "user_data": null, 1175 | "vpc_security_group_ids": null 1176 | }, 1177 | "after_unknown": { 1178 | "arn": true, 1179 | "block_device_mappings": [ 1180 | { 1181 | "ebs": [ 1182 | { 1183 | "iops": true, 1184 | "volume_type": true 1185 | } 1186 | ] 1187 | }, 1188 | { 1189 | "ebs": [ 1190 | { 1191 | "iops": true 1192 | } 1193 | ] 1194 | }, 1195 | { 1196 | "ebs": [ 1197 | {} 1198 | ] 1199 | } 1200 | ], 1201 | "capacity_reservation_specification": [], 1202 | "cpu_options": [], 1203 | "credit_specification": [], 1204 | "default_version": true, 1205 | "elastic_gpu_specifications": [ 1206 | {}, 1207 | {} 1208 | ], 1209 | "elastic_inference_accelerator": [ 1210 | {} 1211 | ], 1212 | "hibernation_options": [], 1213 | "iam_instance_profile": [], 1214 | "id": true, 1215 | "instance_market_options": [], 1216 | "latest_version": true, 1217 | "license_specification": [], 1218 | "metadata_options": true, 1219 | "monitoring": [], 1220 | "name": true, 1221 | "network_interfaces": [], 1222 | "placement": [], 1223 | "tag_specifications": [] 1224 | } 1225 | } 1226 | }, 1227 | { 1228 | "address": "aws_lb.nlb", 1229 | "mode": "managed", 1230 | "type": "aws_lb", 1231 | "name": "nlb", 1232 | "provider_name": "aws", 1233 | "change": { 1234 | "actions": [ 1235 | "create" 1236 | ], 1237 | "before": null, 1238 | "after": { 1239 | "access_logs": [], 1240 | "drop_invalid_header_fields": null, 1241 | "enable_cross_zone_load_balancing": false, 1242 | "enable_deletion_protection": false, 1243 | "enable_http2": null, 1244 | "idle_timeout": null, 1245 | "load_balancer_type": "network", 1246 | "name_prefix": null, 1247 | "subnets": [ 1248 | "subnet-816551c9", 1249 | "subnet-8f2442d5", 1250 | "subnet-e3f0d585" 1251 | ], 1252 | "tags": null, 1253 | "timeouts": null 1254 | }, 1255 | "after_unknown": { 1256 | "access_logs": [], 1257 | "arn": true, 1258 | "arn_suffix": true, 1259 | "dns_name": true, 1260 | "id": true, 1261 | "internal": true, 1262 | "ip_address_type": true, 1263 | "name": true, 1264 | "security_groups": true, 1265 | "subnet_mapping": true, 1266 | "subnets": [ 1267 | false, 1268 | false, 1269 | false 1270 | ], 1271 | "vpc_id": true, 1272 | "zone_id": true 1273 | } 1274 | } 1275 | }, 1276 | { 1277 | "address": "aws_nat_gateway.nat", 1278 | "mode": "managed", 1279 | "type": "aws_nat_gateway", 1280 | "name": "nat", 1281 | "provider_name": "aws", 1282 | "change": { 1283 | "actions": [ 1284 | "create" 1285 | ], 1286 | "before": null, 1287 | "after": { 1288 | "subnet_id": "subnet-816551c9", 1289 | "tags": null 1290 | }, 1291 | "after_unknown": { 1292 | "allocation_id": true, 1293 | "id": true, 1294 | "network_interface_id": true, 1295 | "private_ip": true, 1296 | "public_ip": true 1297 | } 1298 | } 1299 | } 1300 | ], 1301 | "prior_state": { 1302 | "format_version": "0.1", 1303 | "terraform_version": "0.12.25", 1304 | "values": { 1305 | "root_module": { 1306 | "resources": [ 1307 | { 1308 | "address": "data.aws_ami.amazon_linux2", 1309 | "mode": "data", 1310 | "type": "aws_ami", 1311 | "name": "amazon_linux2", 1312 | "provider_name": "aws", 1313 | "schema_version": 0, 1314 | "values": { 1315 | "architecture": "x86_64", 1316 | "block_device_mappings": [ 1317 | { 1318 | "device_name": "/dev/xvda", 1319 | "ebs": { 1320 | "delete_on_termination": "true", 1321 | "encrypted": "false", 1322 | "iops": "0", 1323 | "snapshot_id": "snap-01f2b7e1abc1981b3", 1324 | "volume_size": "8", 1325 | "volume_type": "gp2" 1326 | }, 1327 | "no_device": "", 1328 | "virtual_name": "" 1329 | } 1330 | ], 1331 | "creation_date": "2020-04-07T17:30:35.000Z", 1332 | "description": "Amazon Linux 2 AMI 2.0.20200406.0 x86_64 HVM gp2", 1333 | "executable_users": null, 1334 | "filter": [ 1335 | { 1336 | "name": "architecture", 1337 | "values": [ 1338 | "x86_64" 1339 | ] 1340 | }, 1341 | { 1342 | "name": "name", 1343 | "values": [ 1344 | "amzn2-ami-hvm-*" 1345 | ] 1346 | }, 1347 | { 1348 | "name": "root-device-type", 1349 | "values": [ 1350 | "ebs" 1351 | ] 1352 | }, 1353 | { 1354 | "name": "virtualization-type", 1355 | "values": [ 1356 | "hvm" 1357 | ] 1358 | } 1359 | ], 1360 | "hypervisor": "xen", 1361 | "id": "ami-06ce3edf0cff21f07", 1362 | "image_id": "ami-06ce3edf0cff21f07", 1363 | "image_location": "amazon/amzn2-ami-hvm-2.0.20200406.0-x86_64-gp2", 1364 | "image_owner_alias": "amazon", 1365 | "image_type": "machine", 1366 | "kernel_id": null, 1367 | "most_recent": true, 1368 | "name": "amzn2-ami-hvm-2.0.20200406.0-x86_64-gp2", 1369 | "name_regex": null, 1370 | "owner_id": "137112412989", 1371 | "owners": [ 1372 | "137112412989" 1373 | ], 1374 | "platform": null, 1375 | "product_codes": [], 1376 | "public": true, 1377 | "ramdisk_id": null, 1378 | "root_device_name": "/dev/xvda", 1379 | "root_device_type": "ebs", 1380 | "root_snapshot_id": "snap-01f2b7e1abc1981b3", 1381 | "sriov_net_support": "simple", 1382 | "state": "available", 1383 | "state_reason": { 1384 | "code": "UNSET", 1385 | "message": "UNSET" 1386 | }, 1387 | "tags": {}, 1388 | "virtualization_type": "hvm" 1389 | } 1390 | }, 1391 | { 1392 | "address": "data.aws_availability_zones.available", 1393 | "mode": "data", 1394 | "type": "aws_availability_zones", 1395 | "name": "available", 1396 | "provider_name": "aws", 1397 | "schema_version": 0, 1398 | "values": { 1399 | "all_availability_zones": null, 1400 | "blacklisted_names": null, 1401 | "blacklisted_zone_ids": null, 1402 | "filter": null, 1403 | "group_names": [ 1404 | "eu-west-1" 1405 | ], 1406 | "id": "2020-05-22 15:37:39.453089 +0000 UTC", 1407 | "names": [ 1408 | "eu-west-1a", 1409 | "eu-west-1b", 1410 | "eu-west-1c" 1411 | ], 1412 | "state": null, 1413 | "zone_ids": [ 1414 | "euw1-az2", 1415 | "euw1-az3", 1416 | "euw1-az1" 1417 | ] 1418 | } 1419 | }, 1420 | { 1421 | "address": "data.aws_region.selected", 1422 | "mode": "data", 1423 | "type": "aws_region", 1424 | "name": "selected", 1425 | "provider_name": "aws", 1426 | "schema_version": 0, 1427 | "values": { 1428 | "current": null, 1429 | "description": "Europe (Ireland)", 1430 | "endpoint": "ec2.eu-west-1.amazonaws.com", 1431 | "id": "eu-west-1", 1432 | "name": "eu-west-1" 1433 | } 1434 | }, 1435 | { 1436 | "address": "data.aws_subnet_ids.all", 1437 | "mode": "data", 1438 | "type": "aws_subnet_ids", 1439 | "name": "all", 1440 | "provider_name": "aws", 1441 | "schema_version": 0, 1442 | "values": { 1443 | "filter": null, 1444 | "id": "vpc-4b42aa32", 1445 | "ids": [ 1446 | "subnet-816551c9", 1447 | "subnet-8f2442d5", 1448 | "subnet-e3f0d585" 1449 | ], 1450 | "tags": null, 1451 | "vpc_id": "vpc-4b42aa32" 1452 | } 1453 | }, 1454 | { 1455 | "address": "data.aws_vpc.default", 1456 | "mode": "data", 1457 | "type": "aws_vpc", 1458 | "name": "default", 1459 | "provider_name": "aws", 1460 | "schema_version": 0, 1461 | "values": { 1462 | "arn": "arn:aws:ec2:eu-west-1:052235879155:vpc/vpc-4b42aa32", 1463 | "cidr_block": "172.31.0.0/16", 1464 | "cidr_block_associations": [ 1465 | { 1466 | "association_id": "vpc-cidr-assoc-d7fdedbc", 1467 | "cidr_block": "172.31.0.0/16", 1468 | "state": "associated" 1469 | } 1470 | ], 1471 | "default": true, 1472 | "dhcp_options_id": "dopt-f80e549e", 1473 | "enable_dns_hostnames": true, 1474 | "enable_dns_support": true, 1475 | "filter": null, 1476 | "id": "vpc-4b42aa32", 1477 | "instance_tenancy": "default", 1478 | "ipv6_association_id": null, 1479 | "ipv6_cidr_block": null, 1480 | "main_route_table_id": "rtb-a73c2ede", 1481 | "owner_id": "052235879155", 1482 | "state": "available", 1483 | "tags": {} 1484 | } 1485 | } 1486 | ] 1487 | } 1488 | } 1489 | }, 1490 | "configuration": { 1491 | "provider_config": { 1492 | "aws": { 1493 | "name": "aws", 1494 | "expressions": { 1495 | "region": { 1496 | "constant_value": "eu-west-1" 1497 | } 1498 | } 1499 | } 1500 | }, 1501 | "root_module": { 1502 | "resources": [ 1503 | { 1504 | "address": "aws_alb.alb", 1505 | "mode": "managed", 1506 | "type": "aws_alb", 1507 | "name": "alb", 1508 | "provider_config_key": "aws", 1509 | "expressions": { 1510 | "load_balancer_type": { 1511 | "constant_value": "application" 1512 | }, 1513 | "subnets": { 1514 | "references": [ 1515 | "data.aws_subnet_ids.all" 1516 | ] 1517 | } 1518 | }, 1519 | "schema_version": 0 1520 | }, 1521 | { 1522 | "address": "aws_autoscaling_group.lc", 1523 | "mode": "managed", 1524 | "type": "aws_autoscaling_group", 1525 | "name": "lc", 1526 | "provider_config_key": "aws", 1527 | "expressions": { 1528 | "desired_capacity": { 1529 | "constant_value": 1 1530 | }, 1531 | "launch_configuration": { 1532 | "references": [ 1533 | "aws_launch_configuration.lc" 1534 | ] 1535 | }, 1536 | "max_size": { 1537 | "constant_value": 2 1538 | }, 1539 | "min_size": { 1540 | "constant_value": 0 1541 | }, 1542 | "vpc_zone_identifier": { 1543 | "references": [ 1544 | "data.aws_subnet_ids.all" 1545 | ] 1546 | } 1547 | }, 1548 | "schema_version": 0 1549 | }, 1550 | { 1551 | "address": "aws_autoscaling_group.lt", 1552 | "mode": "managed", 1553 | "type": "aws_autoscaling_group", 1554 | "name": "lt", 1555 | "provider_config_key": "aws", 1556 | "expressions": { 1557 | "desired_capacity": { 1558 | "constant_value": 1 1559 | }, 1560 | "launch_template": [ 1561 | { 1562 | "id": { 1563 | "references": [ 1564 | "aws_launch_template.lt" 1565 | ] 1566 | }, 1567 | "version": { 1568 | "constant_value": "$Latest" 1569 | } 1570 | } 1571 | ], 1572 | "max_size": { 1573 | "constant_value": 2 1574 | }, 1575 | "min_size": { 1576 | "constant_value": 0 1577 | }, 1578 | "vpc_zone_identifier": { 1579 | "references": [ 1580 | "data.aws_subnet_ids.all" 1581 | ] 1582 | } 1583 | }, 1584 | "schema_version": 0 1585 | }, 1586 | { 1587 | "address": "aws_ebs_snapshot.standard", 1588 | "mode": "managed", 1589 | "type": "aws_ebs_snapshot", 1590 | "name": "standard", 1591 | "provider_config_key": "aws", 1592 | "expressions": { 1593 | "volume_id": { 1594 | "references": [ 1595 | "aws_ebs_volume.volume_standard" 1596 | ] 1597 | } 1598 | }, 1599 | "schema_version": 0 1600 | }, 1601 | { 1602 | "address": "aws_ebs_snapshot_copy.copied", 1603 | "mode": "managed", 1604 | "type": "aws_ebs_snapshot_copy", 1605 | "name": "copied", 1606 | "provider_config_key": "aws", 1607 | "expressions": { 1608 | "source_region": { 1609 | "references": [ 1610 | "data.aws_region.selected" 1611 | ] 1612 | }, 1613 | "source_snapshot_id": { 1614 | "references": [ 1615 | "aws_ebs_snapshot.standard" 1616 | ] 1617 | } 1618 | }, 1619 | "schema_version": 0 1620 | }, 1621 | { 1622 | "address": "aws_ebs_volume.volume_io1", 1623 | "mode": "managed", 1624 | "type": "aws_ebs_volume", 1625 | "name": "volume_io1", 1626 | "provider_config_key": "aws", 1627 | "expressions": { 1628 | "availability_zone": { 1629 | "references": [ 1630 | "data.aws_availability_zones.available" 1631 | ] 1632 | }, 1633 | "iops": { 1634 | "constant_value": 300 1635 | }, 1636 | "size": { 1637 | "constant_value": 8 1638 | }, 1639 | "type": { 1640 | "constant_value": "io1" 1641 | } 1642 | }, 1643 | "schema_version": 0 1644 | }, 1645 | { 1646 | "address": "aws_ebs_volume.volume_standard", 1647 | "mode": "managed", 1648 | "type": "aws_ebs_volume", 1649 | "name": "volume_standard", 1650 | "provider_config_key": "aws", 1651 | "expressions": { 1652 | "availability_zone": { 1653 | "references": [ 1654 | "data.aws_availability_zones.available" 1655 | ] 1656 | }, 1657 | "size": { 1658 | "constant_value": 7 1659 | }, 1660 | "type": { 1661 | "constant_value": "standard" 1662 | } 1663 | }, 1664 | "schema_version": 0 1665 | }, 1666 | { 1667 | "address": "aws_ec2_fleet.lt", 1668 | "mode": "managed", 1669 | "type": "aws_ec2_fleet", 1670 | "name": "lt", 1671 | "provider_config_key": "aws", 1672 | "expressions": { 1673 | "launch_template_config": [ 1674 | { 1675 | "launch_template_specification": [ 1676 | { 1677 | "launch_template_id": { 1678 | "references": [ 1679 | "aws_launch_template.lt" 1680 | ] 1681 | }, 1682 | "version": { 1683 | "references": [ 1684 | "aws_launch_template.lt" 1685 | ] 1686 | } 1687 | } 1688 | ] 1689 | } 1690 | ], 1691 | "target_capacity_specification": [ 1692 | { 1693 | "default_target_capacity_type": { 1694 | "constant_value": "on-demand" 1695 | }, 1696 | "total_target_capacity": { 1697 | "constant_value": 1 1698 | } 1699 | } 1700 | ] 1701 | }, 1702 | "schema_version": 0 1703 | }, 1704 | { 1705 | "address": "aws_eip.nat", 1706 | "mode": "managed", 1707 | "type": "aws_eip", 1708 | "name": "nat", 1709 | "provider_config_key": "aws", 1710 | "expressions": { 1711 | "vpc": { 1712 | "constant_value": true 1713 | } 1714 | }, 1715 | "schema_version": 0 1716 | }, 1717 | { 1718 | "address": "aws_elb.elb", 1719 | "mode": "managed", 1720 | "type": "aws_elb", 1721 | "name": "elb", 1722 | "provider_config_key": "aws", 1723 | "expressions": { 1724 | "listener": [ 1725 | { 1726 | "instance_port": { 1727 | "constant_value": 80 1728 | }, 1729 | "instance_protocol": { 1730 | "constant_value": "HTTP" 1731 | }, 1732 | "lb_port": { 1733 | "constant_value": 80 1734 | }, 1735 | "lb_protocol": { 1736 | "constant_value": "HTTP" 1737 | } 1738 | } 1739 | ], 1740 | "subnets": { 1741 | "references": [ 1742 | "data.aws_subnet_ids.all" 1743 | ] 1744 | } 1745 | }, 1746 | "schema_version": 0 1747 | }, 1748 | { 1749 | "address": "aws_instance.this_1", 1750 | "mode": "managed", 1751 | "type": "aws_instance", 1752 | "name": "this_1", 1753 | "provider_config_key": "aws", 1754 | "expressions": { 1755 | "ami": { 1756 | "references": [ 1757 | "data.aws_ami.amazon_linux2" 1758 | ] 1759 | }, 1760 | "ebs_block_device": [ 1761 | { 1762 | "device_name": { 1763 | "constant_value": "xvfs" 1764 | }, 1765 | "volume_size": { 1766 | "constant_value": 10 1767 | } 1768 | }, 1769 | { 1770 | "device_name": { 1771 | "constant_value": "xvfa" 1772 | }, 1773 | "volume_size": { 1774 | "constant_value": 20 1775 | }, 1776 | "volume_type": { 1777 | "constant_value": "sc1" 1778 | } 1779 | }, 1780 | { 1781 | "device_name": { 1782 | "constant_value": "xvfb" 1783 | }, 1784 | "iops": { 1785 | "constant_value": 2000 1786 | }, 1787 | "volume_size": { 1788 | "constant_value": 30 1789 | }, 1790 | "volume_type": { 1791 | "constant_value": "io1" 1792 | } 1793 | } 1794 | ], 1795 | "instance_type": { 1796 | "constant_value": "t3.nano" 1797 | }, 1798 | "root_block_device": [ 1799 | { 1800 | "iops": { 1801 | "constant_value": 220 1802 | }, 1803 | "volume_type": { 1804 | "constant_value": "io1" 1805 | } 1806 | } 1807 | ] 1808 | }, 1809 | "schema_version": 1 1810 | }, 1811 | { 1812 | "address": "aws_launch_configuration.lc", 1813 | "mode": "managed", 1814 | "type": "aws_launch_configuration", 1815 | "name": "lc", 1816 | "provider_config_key": "aws", 1817 | "expressions": { 1818 | "image_id": { 1819 | "references": [ 1820 | "data.aws_ami.amazon_linux2" 1821 | ] 1822 | }, 1823 | "instance_type": { 1824 | "constant_value": "t2.micro" 1825 | } 1826 | }, 1827 | "schema_version": 0 1828 | }, 1829 | { 1830 | "address": "aws_launch_template.lt", 1831 | "mode": "managed", 1832 | "type": "aws_launch_template", 1833 | "name": "lt", 1834 | "provider_config_key": "aws", 1835 | "expressions": { 1836 | "block_device_mappings": [ 1837 | { 1838 | "device_name": { 1839 | "constant_value": "xvfs" 1840 | }, 1841 | "ebs": [ 1842 | { 1843 | "volume_size": { 1844 | "constant_value": 11 1845 | } 1846 | } 1847 | ] 1848 | }, 1849 | { 1850 | "device_name": { 1851 | "constant_value": "xvfa" 1852 | }, 1853 | "ebs": [ 1854 | { 1855 | "volume_size": { 1856 | "constant_value": 21 1857 | }, 1858 | "volume_type": { 1859 | "constant_value": "sc1" 1860 | } 1861 | } 1862 | ] 1863 | }, 1864 | { 1865 | "device_name": { 1866 | "constant_value": "xvfb" 1867 | }, 1868 | "ebs": [ 1869 | { 1870 | "iops": { 1871 | "constant_value": 2001 1872 | }, 1873 | "volume_size": { 1874 | "constant_value": 31 1875 | }, 1876 | "volume_type": { 1877 | "constant_value": "io1" 1878 | } 1879 | } 1880 | ] 1881 | } 1882 | ], 1883 | "elastic_gpu_specifications": [ 1884 | { 1885 | "type": { 1886 | "constant_value": "eg1.medium" 1887 | } 1888 | }, 1889 | { 1890 | "type": { 1891 | "constant_value": "eg1.large" 1892 | } 1893 | } 1894 | ], 1895 | "elastic_inference_accelerator": [ 1896 | { 1897 | "type": { 1898 | "constant_value": "eia1.medium" 1899 | } 1900 | } 1901 | ], 1902 | "image_id": { 1903 | "references": [ 1904 | "data.aws_ami.amazon_linux2" 1905 | ] 1906 | }, 1907 | "instance_type": { 1908 | "constant_value": "t2.nano" 1909 | } 1910 | }, 1911 | "schema_version": 0 1912 | }, 1913 | { 1914 | "address": "aws_lb.nlb", 1915 | "mode": "managed", 1916 | "type": "aws_lb", 1917 | "name": "nlb", 1918 | "provider_config_key": "aws", 1919 | "expressions": { 1920 | "load_balancer_type": { 1921 | "constant_value": "network" 1922 | }, 1923 | "subnets": { 1924 | "references": [ 1925 | "data.aws_subnet_ids.all" 1926 | ] 1927 | } 1928 | }, 1929 | "schema_version": 0 1930 | }, 1931 | { 1932 | "address": "aws_nat_gateway.nat", 1933 | "mode": "managed", 1934 | "type": "aws_nat_gateway", 1935 | "name": "nat", 1936 | "provider_config_key": "aws", 1937 | "expressions": { 1938 | "allocation_id": { 1939 | "references": [ 1940 | "aws_eip.nat" 1941 | ] 1942 | }, 1943 | "subnet_id": { 1944 | "references": [ 1945 | "data.aws_subnet_ids.all" 1946 | ] 1947 | } 1948 | }, 1949 | "schema_version": 0 1950 | }, 1951 | { 1952 | "address": "data.aws_ami.amazon_linux2", 1953 | "mode": "data", 1954 | "type": "aws_ami", 1955 | "name": "amazon_linux2", 1956 | "provider_config_key": "aws", 1957 | "expressions": { 1958 | "filter": [ 1959 | { 1960 | "name": { 1961 | "constant_value": "name" 1962 | }, 1963 | "values": { 1964 | "constant_value": [ 1965 | "amzn2-ami-hvm-*" 1966 | ] 1967 | } 1968 | }, 1969 | { 1970 | "name": { 1971 | "constant_value": "root-device-type" 1972 | }, 1973 | "values": { 1974 | "constant_value": [ 1975 | "ebs" 1976 | ] 1977 | } 1978 | }, 1979 | { 1980 | "name": { 1981 | "constant_value": "architecture" 1982 | }, 1983 | "values": { 1984 | "constant_value": [ 1985 | "x86_64" 1986 | ] 1987 | } 1988 | }, 1989 | { 1990 | "name": { 1991 | "constant_value": "virtualization-type" 1992 | }, 1993 | "values": { 1994 | "constant_value": [ 1995 | "hvm" 1996 | ] 1997 | } 1998 | } 1999 | ], 2000 | "most_recent": { 2001 | "constant_value": true 2002 | }, 2003 | "owners": { 2004 | "constant_value": [ 2005 | "137112412989" 2006 | ] 2007 | } 2008 | }, 2009 | "schema_version": 0 2010 | }, 2011 | { 2012 | "address": "data.aws_availability_zones.available", 2013 | "mode": "data", 2014 | "type": "aws_availability_zones", 2015 | "name": "available", 2016 | "provider_config_key": "aws", 2017 | "schema_version": 0 2018 | }, 2019 | { 2020 | "address": "data.aws_region.selected", 2021 | "mode": "data", 2022 | "type": "aws_region", 2023 | "name": "selected", 2024 | "provider_config_key": "aws", 2025 | "schema_version": 0 2026 | }, 2027 | { 2028 | "address": "data.aws_subnet_ids.all", 2029 | "mode": "data", 2030 | "type": "aws_subnet_ids", 2031 | "name": "all", 2032 | "provider_config_key": "aws", 2033 | "expressions": { 2034 | "vpc_id": { 2035 | "references": [ 2036 | "data.aws_vpc.default" 2037 | ] 2038 | } 2039 | }, 2040 | "schema_version": 0 2041 | }, 2042 | { 2043 | "address": "data.aws_vpc.default", 2044 | "mode": "data", 2045 | "type": "aws_vpc", 2046 | "name": "default", 2047 | "provider_config_key": "aws", 2048 | "expressions": { 2049 | "default": { 2050 | "constant_value": true 2051 | } 2052 | }, 2053 | "schema_version": 0 2054 | } 2055 | ] 2056 | } 2057 | } 2058 | } 2059 | -------------------------------------------------------------------------------- /samples/terraform012-plan.json: -------------------------------------------------------------------------------- 1 | { 2 | "format_version": "0.1", 3 | "terraform_version": "0.12.24", 4 | "planned_values": { 5 | "root_module": { 6 | "resources": [ 7 | { 8 | "address": "aws_instance.this_1", 9 | "mode": "managed", 10 | "type": "aws_instance", 11 | "name": "this_1", 12 | "provider_name": "aws", 13 | "schema_version": 1, 14 | "values": { 15 | "ami": "ami-06ce3edf0cff21f07", 16 | "arn": "arn:aws:ec2:eu-west-1:052235879155:instance/i-0ff90abfc4ed5e1ba", 17 | "associate_public_ip_address": true, 18 | "availability_zone": "eu-west-1b", 19 | "cpu_core_count": 1, 20 | "cpu_threads_per_core": 1, 21 | "credit_specification": [ 22 | { 23 | "cpu_credits": "standard" 24 | } 25 | ], 26 | "disable_api_termination": false, 27 | "ebs_block_device": [], 28 | "ebs_optimized": false, 29 | "ephemeral_block_device": [], 30 | "get_password_data": false, 31 | "hibernation": false, 32 | "host_id": null, 33 | "iam_instance_profile": "", 34 | "id": "i-0ff90abfc4ed5e1ba", 35 | "instance_initiated_shutdown_behavior": null, 36 | "instance_state": "running", 37 | "instance_type": "t2.nano", 38 | "ipv6_address_count": 0, 39 | "ipv6_addresses": [], 40 | "key_name": "", 41 | "metadata_options": [ 42 | { 43 | "http_endpoint": "enabled", 44 | "http_put_response_hop_limit": 1, 45 | "http_tokens": "optional" 46 | } 47 | ], 48 | "monitoring": false, 49 | "network_interface": [], 50 | "network_interface_id": null, 51 | "password_data": "", 52 | "placement_group": "", 53 | "primary_network_interface_id": "eni-002eab501459346af", 54 | "private_dns": "ip-172-31-44-202.eu-west-1.compute.internal", 55 | "private_ip": "172.31.44.202", 56 | "public_dns": "ec2-52-50-132-229.eu-west-1.compute.amazonaws.com", 57 | "public_ip": "52.50.132.229", 58 | "root_block_device": [ 59 | { 60 | "delete_on_termination": true, 61 | "device_name": "/dev/xvda", 62 | "encrypted": false, 63 | "iops": 100, 64 | "kms_key_id": "", 65 | "volume_id": "vol-082792576e14c7035", 66 | "volume_size": 8, 67 | "volume_type": "gp2" 68 | } 69 | ], 70 | "security_groups": [ 71 | "default" 72 | ], 73 | "source_dest_check": true, 74 | "subnet_id": "subnet-8f2442d5", 75 | "tags": {}, 76 | "tenancy": "default", 77 | "timeouts": null, 78 | "user_data": null, 79 | "user_data_base64": null, 80 | "volume_tags": {}, 81 | "vpc_security_group_ids": [ 82 | "sg-cd637381" 83 | ] 84 | } 85 | }, 86 | { 87 | "address": "aws_instance.this_2[0]", 88 | "mode": "managed", 89 | "type": "aws_instance", 90 | "name": "this_2", 91 | "index": 0, 92 | "provider_name": "aws", 93 | "schema_version": 1, 94 | "values": { 95 | "ami": "ami-06ce3edf0cff21f07", 96 | "arn": "arn:aws:ec2:eu-west-1:052235879155:instance/i-0beba2f332faca794", 97 | "associate_public_ip_address": true, 98 | "availability_zone": "eu-west-1b", 99 | "cpu_core_count": 1, 100 | "cpu_threads_per_core": 1, 101 | "credit_specification": [ 102 | { 103 | "cpu_credits": "standard" 104 | } 105 | ], 106 | "disable_api_termination": false, 107 | "ebs_block_device": [], 108 | "ebs_optimized": false, 109 | "ephemeral_block_device": [], 110 | "get_password_data": false, 111 | "hibernation": false, 112 | "host_id": null, 113 | "iam_instance_profile": "", 114 | "id": "i-0beba2f332faca794", 115 | "instance_initiated_shutdown_behavior": null, 116 | "instance_state": "running", 117 | "instance_type": "t2.nano", 118 | "ipv6_address_count": 0, 119 | "ipv6_addresses": [], 120 | "key_name": "", 121 | "metadata_options": [ 122 | { 123 | "http_endpoint": "enabled", 124 | "http_put_response_hop_limit": 1, 125 | "http_tokens": "optional" 126 | } 127 | ], 128 | "monitoring": false, 129 | "network_interface": [], 130 | "network_interface_id": null, 131 | "password_data": "", 132 | "placement_group": "", 133 | "primary_network_interface_id": "eni-0865bb546346ee32b", 134 | "private_dns": "ip-172-31-43-244.eu-west-1.compute.internal", 135 | "private_ip": "172.31.43.244", 136 | "public_dns": "ec2-54-72-223-23.eu-west-1.compute.amazonaws.com", 137 | "public_ip": "54.72.223.23", 138 | "root_block_device": [ 139 | { 140 | "delete_on_termination": true, 141 | "device_name": "/dev/xvda", 142 | "encrypted": false, 143 | "iops": 100, 144 | "kms_key_id": "", 145 | "volume_id": "vol-0dc04d972ff05f0d9", 146 | "volume_size": 8, 147 | "volume_type": "gp2" 148 | } 149 | ], 150 | "security_groups": [ 151 | "default" 152 | ], 153 | "source_dest_check": true, 154 | "subnet_id": "subnet-8f2442d5", 155 | "tags": {}, 156 | "tenancy": "default", 157 | "timeouts": null, 158 | "user_data": null, 159 | "user_data_base64": null, 160 | "volume_tags": {}, 161 | "vpc_security_group_ids": [ 162 | "sg-cd637381" 163 | ] 164 | } 165 | } 166 | ] 167 | } 168 | }, 169 | "resource_changes": [ 170 | { 171 | "address": "aws_instance.this_1", 172 | "mode": "managed", 173 | "type": "aws_instance", 174 | "name": "this_1", 175 | "provider_name": "aws", 176 | "change": { 177 | "actions": [ 178 | "no-op" 179 | ], 180 | "before": { 181 | "ami": "ami-06ce3edf0cff21f07", 182 | "arn": "arn:aws:ec2:eu-west-1:052235879155:instance/i-0ff90abfc4ed5e1ba", 183 | "associate_public_ip_address": true, 184 | "availability_zone": "eu-west-1b", 185 | "cpu_core_count": 1, 186 | "cpu_threads_per_core": 1, 187 | "credit_specification": [ 188 | { 189 | "cpu_credits": "standard" 190 | } 191 | ], 192 | "disable_api_termination": false, 193 | "ebs_block_device": [], 194 | "ebs_optimized": false, 195 | "ephemeral_block_device": [], 196 | "get_password_data": false, 197 | "hibernation": false, 198 | "host_id": null, 199 | "iam_instance_profile": "", 200 | "id": "i-0ff90abfc4ed5e1ba", 201 | "instance_initiated_shutdown_behavior": null, 202 | "instance_state": "running", 203 | "instance_type": "t2.nano", 204 | "ipv6_address_count": 0, 205 | "ipv6_addresses": [], 206 | "key_name": "", 207 | "metadata_options": [ 208 | { 209 | "http_endpoint": "enabled", 210 | "http_put_response_hop_limit": 1, 211 | "http_tokens": "optional" 212 | } 213 | ], 214 | "monitoring": false, 215 | "network_interface": [], 216 | "network_interface_id": null, 217 | "password_data": "", 218 | "placement_group": "", 219 | "primary_network_interface_id": "eni-002eab501459346af", 220 | "private_dns": "ip-172-31-44-202.eu-west-1.compute.internal", 221 | "private_ip": "172.31.44.202", 222 | "public_dns": "ec2-52-50-132-229.eu-west-1.compute.amazonaws.com", 223 | "public_ip": "52.50.132.229", 224 | "root_block_device": [ 225 | { 226 | "delete_on_termination": true, 227 | "device_name": "/dev/xvda", 228 | "encrypted": false, 229 | "iops": 100, 230 | "kms_key_id": "", 231 | "volume_id": "vol-082792576e14c7035", 232 | "volume_size": 8, 233 | "volume_type": "gp2" 234 | } 235 | ], 236 | "security_groups": [ 237 | "default" 238 | ], 239 | "source_dest_check": true, 240 | "subnet_id": "subnet-8f2442d5", 241 | "tags": {}, 242 | "tenancy": "default", 243 | "timeouts": null, 244 | "user_data": null, 245 | "user_data_base64": null, 246 | "volume_tags": {}, 247 | "vpc_security_group_ids": [ 248 | "sg-cd637381" 249 | ] 250 | }, 251 | "after": { 252 | "ami": "ami-06ce3edf0cff21f07", 253 | "arn": "arn:aws:ec2:eu-west-1:052235879155:instance/i-0ff90abfc4ed5e1ba", 254 | "associate_public_ip_address": true, 255 | "availability_zone": "eu-west-1b", 256 | "cpu_core_count": 1, 257 | "cpu_threads_per_core": 1, 258 | "credit_specification": [ 259 | { 260 | "cpu_credits": "standard" 261 | } 262 | ], 263 | "disable_api_termination": false, 264 | "ebs_block_device": [], 265 | "ebs_optimized": false, 266 | "ephemeral_block_device": [], 267 | "get_password_data": false, 268 | "hibernation": false, 269 | "host_id": null, 270 | "iam_instance_profile": "", 271 | "id": "i-0ff90abfc4ed5e1ba", 272 | "instance_initiated_shutdown_behavior": null, 273 | "instance_state": "running", 274 | "instance_type": "t2.nano", 275 | "ipv6_address_count": 0, 276 | "ipv6_addresses": [], 277 | "key_name": "", 278 | "metadata_options": [ 279 | { 280 | "http_endpoint": "enabled", 281 | "http_put_response_hop_limit": 1, 282 | "http_tokens": "optional" 283 | } 284 | ], 285 | "monitoring": false, 286 | "network_interface": [], 287 | "network_interface_id": null, 288 | "password_data": "", 289 | "placement_group": "", 290 | "primary_network_interface_id": "eni-002eab501459346af", 291 | "private_dns": "ip-172-31-44-202.eu-west-1.compute.internal", 292 | "private_ip": "172.31.44.202", 293 | "public_dns": "ec2-52-50-132-229.eu-west-1.compute.amazonaws.com", 294 | "public_ip": "52.50.132.229", 295 | "root_block_device": [ 296 | { 297 | "delete_on_termination": true, 298 | "device_name": "/dev/xvda", 299 | "encrypted": false, 300 | "iops": 100, 301 | "kms_key_id": "", 302 | "volume_id": "vol-082792576e14c7035", 303 | "volume_size": 8, 304 | "volume_type": "gp2" 305 | } 306 | ], 307 | "security_groups": [ 308 | "default" 309 | ], 310 | "source_dest_check": true, 311 | "subnet_id": "subnet-8f2442d5", 312 | "tags": {}, 313 | "tenancy": "default", 314 | "timeouts": null, 315 | "user_data": null, 316 | "user_data_base64": null, 317 | "volume_tags": {}, 318 | "vpc_security_group_ids": [ 319 | "sg-cd637381" 320 | ] 321 | }, 322 | "after_unknown": {} 323 | } 324 | }, 325 | { 326 | "address": "aws_instance.this_2[0]", 327 | "mode": "managed", 328 | "type": "aws_instance", 329 | "name": "this_2", 330 | "index": 0, 331 | "provider_name": "aws", 332 | "change": { 333 | "actions": [ 334 | "no-op" 335 | ], 336 | "before": { 337 | "ami": "ami-06ce3edf0cff21f07", 338 | "arn": "arn:aws:ec2:eu-west-1:052235879155:instance/i-0beba2f332faca794", 339 | "associate_public_ip_address": true, 340 | "availability_zone": "eu-west-1b", 341 | "cpu_core_count": 1, 342 | "cpu_threads_per_core": 1, 343 | "credit_specification": [ 344 | { 345 | "cpu_credits": "standard" 346 | } 347 | ], 348 | "disable_api_termination": false, 349 | "ebs_block_device": [], 350 | "ebs_optimized": false, 351 | "ephemeral_block_device": [], 352 | "get_password_data": false, 353 | "hibernation": false, 354 | "host_id": null, 355 | "iam_instance_profile": "", 356 | "id": "i-0beba2f332faca794", 357 | "instance_initiated_shutdown_behavior": null, 358 | "instance_state": "running", 359 | "instance_type": "t2.nano", 360 | "ipv6_address_count": 0, 361 | "ipv6_addresses": [], 362 | "key_name": "", 363 | "metadata_options": [ 364 | { 365 | "http_endpoint": "enabled", 366 | "http_put_response_hop_limit": 1, 367 | "http_tokens": "optional" 368 | } 369 | ], 370 | "monitoring": false, 371 | "network_interface": [], 372 | "network_interface_id": null, 373 | "password_data": "", 374 | "placement_group": "", 375 | "primary_network_interface_id": "eni-0865bb546346ee32b", 376 | "private_dns": "ip-172-31-43-244.eu-west-1.compute.internal", 377 | "private_ip": "172.31.43.244", 378 | "public_dns": "ec2-54-72-223-23.eu-west-1.compute.amazonaws.com", 379 | "public_ip": "54.72.223.23", 380 | "root_block_device": [ 381 | { 382 | "delete_on_termination": true, 383 | "device_name": "/dev/xvda", 384 | "encrypted": false, 385 | "iops": 100, 386 | "kms_key_id": "", 387 | "volume_id": "vol-0dc04d972ff05f0d9", 388 | "volume_size": 8, 389 | "volume_type": "gp2" 390 | } 391 | ], 392 | "security_groups": [ 393 | "default" 394 | ], 395 | "source_dest_check": true, 396 | "subnet_id": "subnet-8f2442d5", 397 | "tags": {}, 398 | "tenancy": "default", 399 | "timeouts": null, 400 | "user_data": null, 401 | "user_data_base64": null, 402 | "volume_tags": {}, 403 | "vpc_security_group_ids": [ 404 | "sg-cd637381" 405 | ] 406 | }, 407 | "after": { 408 | "ami": "ami-06ce3edf0cff21f07", 409 | "arn": "arn:aws:ec2:eu-west-1:052235879155:instance/i-0beba2f332faca794", 410 | "associate_public_ip_address": true, 411 | "availability_zone": "eu-west-1b", 412 | "cpu_core_count": 1, 413 | "cpu_threads_per_core": 1, 414 | "credit_specification": [ 415 | { 416 | "cpu_credits": "standard" 417 | } 418 | ], 419 | "disable_api_termination": false, 420 | "ebs_block_device": [], 421 | "ebs_optimized": false, 422 | "ephemeral_block_device": [], 423 | "get_password_data": false, 424 | "hibernation": false, 425 | "host_id": null, 426 | "iam_instance_profile": "", 427 | "id": "i-0beba2f332faca794", 428 | "instance_initiated_shutdown_behavior": null, 429 | "instance_state": "running", 430 | "instance_type": "t2.nano", 431 | "ipv6_address_count": 0, 432 | "ipv6_addresses": [], 433 | "key_name": "", 434 | "metadata_options": [ 435 | { 436 | "http_endpoint": "enabled", 437 | "http_put_response_hop_limit": 1, 438 | "http_tokens": "optional" 439 | } 440 | ], 441 | "monitoring": false, 442 | "network_interface": [], 443 | "network_interface_id": null, 444 | "password_data": "", 445 | "placement_group": "", 446 | "primary_network_interface_id": "eni-0865bb546346ee32b", 447 | "private_dns": "ip-172-31-43-244.eu-west-1.compute.internal", 448 | "private_ip": "172.31.43.244", 449 | "public_dns": "ec2-54-72-223-23.eu-west-1.compute.amazonaws.com", 450 | "public_ip": "54.72.223.23", 451 | "root_block_device": [ 452 | { 453 | "delete_on_termination": true, 454 | "device_name": "/dev/xvda", 455 | "encrypted": false, 456 | "iops": 100, 457 | "kms_key_id": "", 458 | "volume_id": "vol-0dc04d972ff05f0d9", 459 | "volume_size": 8, 460 | "volume_type": "gp2" 461 | } 462 | ], 463 | "security_groups": [ 464 | "default" 465 | ], 466 | "source_dest_check": true, 467 | "subnet_id": "subnet-8f2442d5", 468 | "tags": {}, 469 | "tenancy": "default", 470 | "timeouts": null, 471 | "user_data": null, 472 | "user_data_base64": null, 473 | "volume_tags": {}, 474 | "vpc_security_group_ids": [ 475 | "sg-cd637381" 476 | ] 477 | }, 478 | "after_unknown": {} 479 | } 480 | }, 481 | { 482 | "address": "aws_instance.this_2[1]", 483 | "mode": "managed", 484 | "type": "aws_instance", 485 | "name": "this_2", 486 | "index": 1, 487 | "provider_name": "aws", 488 | "change": { 489 | "actions": [ 490 | "delete" 491 | ], 492 | "before": { 493 | "ami": "ami-06ce3edf0cff21f07", 494 | "arn": "arn:aws:ec2:eu-west-1:052235879155:instance/i-008d0ad2c532d38bb", 495 | "associate_public_ip_address": true, 496 | "availability_zone": "eu-west-1b", 497 | "cpu_core_count": 1, 498 | "cpu_threads_per_core": 1, 499 | "credit_specification": [ 500 | { 501 | "cpu_credits": "standard" 502 | } 503 | ], 504 | "disable_api_termination": false, 505 | "ebs_block_device": [], 506 | "ebs_optimized": false, 507 | "ephemeral_block_device": [], 508 | "get_password_data": false, 509 | "hibernation": false, 510 | "host_id": null, 511 | "iam_instance_profile": "", 512 | "id": "i-008d0ad2c532d38bb", 513 | "instance_initiated_shutdown_behavior": null, 514 | "instance_state": "running", 515 | "instance_type": "t2.nano", 516 | "ipv6_address_count": 0, 517 | "ipv6_addresses": [], 518 | "key_name": "", 519 | "metadata_options": [ 520 | { 521 | "http_endpoint": "enabled", 522 | "http_put_response_hop_limit": 1, 523 | "http_tokens": "optional" 524 | } 525 | ], 526 | "monitoring": false, 527 | "network_interface": [], 528 | "network_interface_id": null, 529 | "password_data": "", 530 | "placement_group": "", 531 | "primary_network_interface_id": "eni-095d5d98876da1e7c", 532 | "private_dns": "ip-172-31-40-29.eu-west-1.compute.internal", 533 | "private_ip": "172.31.40.29", 534 | "public_dns": "ec2-3-250-98-233.eu-west-1.compute.amazonaws.com", 535 | "public_ip": "3.250.98.233", 536 | "root_block_device": [ 537 | { 538 | "delete_on_termination": true, 539 | "device_name": "/dev/xvda", 540 | "encrypted": false, 541 | "iops": 100, 542 | "kms_key_id": "", 543 | "volume_id": "vol-0ffdb5f235660a58e", 544 | "volume_size": 8, 545 | "volume_type": "gp2" 546 | } 547 | ], 548 | "security_groups": [ 549 | "default" 550 | ], 551 | "source_dest_check": true, 552 | "subnet_id": "subnet-8f2442d5", 553 | "tags": {}, 554 | "tenancy": "default", 555 | "timeouts": null, 556 | "user_data": null, 557 | "user_data_base64": null, 558 | "volume_tags": {}, 559 | "vpc_security_group_ids": [ 560 | "sg-cd637381" 561 | ] 562 | }, 563 | "after": null, 564 | "after_unknown": {} 565 | } 566 | }, 567 | { 568 | "address": "aws_instance.this_3[\"id1\"]", 569 | "mode": "managed", 570 | "type": "aws_instance", 571 | "name": "this_3", 572 | "index": "id1", 573 | "provider_name": "aws", 574 | "change": { 575 | "actions": [ 576 | "delete" 577 | ], 578 | "before": { 579 | "ami": "ami-06ce3edf0cff21f07", 580 | "arn": "arn:aws:ec2:eu-west-1:052235879155:instance/i-02a545abba93c4f1e", 581 | "associate_public_ip_address": true, 582 | "availability_zone": "eu-west-1b", 583 | "cpu_core_count": 1, 584 | "cpu_threads_per_core": 1, 585 | "credit_specification": [ 586 | { 587 | "cpu_credits": "standard" 588 | } 589 | ], 590 | "disable_api_termination": false, 591 | "ebs_block_device": [], 592 | "ebs_optimized": false, 593 | "ephemeral_block_device": [], 594 | "get_password_data": false, 595 | "hibernation": false, 596 | "host_id": null, 597 | "iam_instance_profile": "", 598 | "id": "i-02a545abba93c4f1e", 599 | "instance_initiated_shutdown_behavior": null, 600 | "instance_state": "running", 601 | "instance_type": "t2.nano", 602 | "ipv6_address_count": 0, 603 | "ipv6_addresses": [], 604 | "key_name": "", 605 | "metadata_options": [ 606 | { 607 | "http_endpoint": "enabled", 608 | "http_put_response_hop_limit": 1, 609 | "http_tokens": "optional" 610 | } 611 | ], 612 | "monitoring": false, 613 | "network_interface": [], 614 | "network_interface_id": null, 615 | "password_data": "", 616 | "placement_group": "", 617 | "primary_network_interface_id": "eni-078091a2b07a53835", 618 | "private_dns": "ip-172-31-38-43.eu-west-1.compute.internal", 619 | "private_ip": "172.31.38.43", 620 | "public_dns": "ec2-52-30-16-194.eu-west-1.compute.amazonaws.com", 621 | "public_ip": "52.30.16.194", 622 | "root_block_device": [ 623 | { 624 | "delete_on_termination": true, 625 | "device_name": "/dev/xvda", 626 | "encrypted": false, 627 | "iops": 100, 628 | "kms_key_id": "", 629 | "volume_id": "vol-0cd83ef6e62eafd26", 630 | "volume_size": 8, 631 | "volume_type": "gp2" 632 | } 633 | ], 634 | "security_groups": [ 635 | "default" 636 | ], 637 | "source_dest_check": true, 638 | "subnet_id": "subnet-8f2442d5", 639 | "tags": {}, 640 | "tenancy": "default", 641 | "timeouts": null, 642 | "user_data": null, 643 | "user_data_base64": null, 644 | "volume_tags": {}, 645 | "vpc_security_group_ids": [ 646 | "sg-cd637381" 647 | ] 648 | }, 649 | "after": null, 650 | "after_unknown": {} 651 | } 652 | }, 653 | { 654 | "address": "aws_instance.this_3[\"id2\"]", 655 | "mode": "managed", 656 | "type": "aws_instance", 657 | "name": "this_3", 658 | "index": "id2", 659 | "provider_name": "aws", 660 | "change": { 661 | "actions": [ 662 | "delete" 663 | ], 664 | "before": { 665 | "ami": "ami-06ce3edf0cff21f07", 666 | "arn": "arn:aws:ec2:eu-west-1:052235879155:instance/i-04653b8056614bce0", 667 | "associate_public_ip_address": true, 668 | "availability_zone": "eu-west-1b", 669 | "cpu_core_count": 1, 670 | "cpu_threads_per_core": 1, 671 | "credit_specification": [ 672 | { 673 | "cpu_credits": "standard" 674 | } 675 | ], 676 | "disable_api_termination": false, 677 | "ebs_block_device": [], 678 | "ebs_optimized": false, 679 | "ephemeral_block_device": [], 680 | "get_password_data": false, 681 | "hibernation": false, 682 | "host_id": null, 683 | "iam_instance_profile": "", 684 | "id": "i-04653b8056614bce0", 685 | "instance_initiated_shutdown_behavior": null, 686 | "instance_state": "running", 687 | "instance_type": "t2.nano", 688 | "ipv6_address_count": 0, 689 | "ipv6_addresses": [], 690 | "key_name": "", 691 | "metadata_options": [ 692 | { 693 | "http_endpoint": "enabled", 694 | "http_put_response_hop_limit": 1, 695 | "http_tokens": "optional" 696 | } 697 | ], 698 | "monitoring": false, 699 | "network_interface": [], 700 | "network_interface_id": null, 701 | "password_data": "", 702 | "placement_group": "", 703 | "primary_network_interface_id": "eni-082dad22e1e3eb18e", 704 | "private_dns": "ip-172-31-42-127.eu-west-1.compute.internal", 705 | "private_ip": "172.31.42.127", 706 | "public_dns": "ec2-34-248-151-147.eu-west-1.compute.amazonaws.com", 707 | "public_ip": "34.248.151.147", 708 | "root_block_device": [ 709 | { 710 | "delete_on_termination": true, 711 | "device_name": "/dev/xvda", 712 | "encrypted": false, 713 | "iops": 100, 714 | "kms_key_id": "", 715 | "volume_id": "vol-05f9d25ef617741d2", 716 | "volume_size": 8, 717 | "volume_type": "gp2" 718 | } 719 | ], 720 | "security_groups": [ 721 | "default" 722 | ], 723 | "source_dest_check": true, 724 | "subnet_id": "subnet-8f2442d5", 725 | "tags": {}, 726 | "tenancy": "default", 727 | "timeouts": null, 728 | "user_data": null, 729 | "user_data_base64": null, 730 | "volume_tags": {}, 731 | "vpc_security_group_ids": [ 732 | "sg-cd637381" 733 | ] 734 | }, 735 | "after": null, 736 | "after_unknown": {} 737 | } 738 | } 739 | ], 740 | "prior_state": { 741 | "format_version": "0.1", 742 | "terraform_version": "0.12.24", 743 | "values": { 744 | "root_module": { 745 | "resources": [ 746 | { 747 | "address": "aws_instance.this_1", 748 | "mode": "managed", 749 | "type": "aws_instance", 750 | "name": "this_1", 751 | "provider_name": "aws", 752 | "schema_version": 1, 753 | "values": { 754 | "ami": "ami-06ce3edf0cff21f07", 755 | "arn": "arn:aws:ec2:eu-west-1:052235879155:instance/i-0ff90abfc4ed5e1ba", 756 | "associate_public_ip_address": true, 757 | "availability_zone": "eu-west-1b", 758 | "cpu_core_count": 1, 759 | "cpu_threads_per_core": 1, 760 | "credit_specification": [ 761 | { 762 | "cpu_credits": "standard" 763 | } 764 | ], 765 | "disable_api_termination": false, 766 | "ebs_block_device": [], 767 | "ebs_optimized": false, 768 | "ephemeral_block_device": [], 769 | "get_password_data": false, 770 | "hibernation": false, 771 | "host_id": null, 772 | "iam_instance_profile": "", 773 | "id": "i-0ff90abfc4ed5e1ba", 774 | "instance_initiated_shutdown_behavior": null, 775 | "instance_state": "running", 776 | "instance_type": "t2.nano", 777 | "ipv6_address_count": 0, 778 | "ipv6_addresses": [], 779 | "key_name": "", 780 | "metadata_options": [ 781 | { 782 | "http_endpoint": "enabled", 783 | "http_put_response_hop_limit": 1, 784 | "http_tokens": "optional" 785 | } 786 | ], 787 | "monitoring": false, 788 | "network_interface": [], 789 | "network_interface_id": null, 790 | "password_data": "", 791 | "placement_group": "", 792 | "primary_network_interface_id": "eni-002eab501459346af", 793 | "private_dns": "ip-172-31-44-202.eu-west-1.compute.internal", 794 | "private_ip": "172.31.44.202", 795 | "public_dns": "ec2-52-50-132-229.eu-west-1.compute.amazonaws.com", 796 | "public_ip": "52.50.132.229", 797 | "root_block_device": [ 798 | { 799 | "delete_on_termination": true, 800 | "device_name": "/dev/xvda", 801 | "encrypted": false, 802 | "iops": 100, 803 | "kms_key_id": "", 804 | "volume_id": "vol-082792576e14c7035", 805 | "volume_size": 8, 806 | "volume_type": "gp2" 807 | } 808 | ], 809 | "security_groups": [ 810 | "default" 811 | ], 812 | "source_dest_check": true, 813 | "subnet_id": "subnet-8f2442d5", 814 | "tags": {}, 815 | "tenancy": "default", 816 | "timeouts": null, 817 | "user_data": null, 818 | "user_data_base64": null, 819 | "volume_tags": {}, 820 | "vpc_security_group_ids": [ 821 | "sg-cd637381" 822 | ] 823 | } 824 | }, 825 | { 826 | "address": "aws_instance.this_2", 827 | "mode": "managed", 828 | "type": "aws_instance", 829 | "name": "this_2", 830 | "index": 0, 831 | "provider_name": "aws", 832 | "schema_version": 1, 833 | "values": { 834 | "ami": "ami-06ce3edf0cff21f07", 835 | "arn": "arn:aws:ec2:eu-west-1:052235879155:instance/i-0beba2f332faca794", 836 | "associate_public_ip_address": true, 837 | "availability_zone": "eu-west-1b", 838 | "cpu_core_count": 1, 839 | "cpu_threads_per_core": 1, 840 | "credit_specification": [ 841 | { 842 | "cpu_credits": "standard" 843 | } 844 | ], 845 | "disable_api_termination": false, 846 | "ebs_block_device": [], 847 | "ebs_optimized": false, 848 | "ephemeral_block_device": [], 849 | "get_password_data": false, 850 | "hibernation": false, 851 | "host_id": null, 852 | "iam_instance_profile": "", 853 | "id": "i-0beba2f332faca794", 854 | "instance_initiated_shutdown_behavior": null, 855 | "instance_state": "running", 856 | "instance_type": "t2.nano", 857 | "ipv6_address_count": 0, 858 | "ipv6_addresses": [], 859 | "key_name": "", 860 | "metadata_options": [ 861 | { 862 | "http_endpoint": "enabled", 863 | "http_put_response_hop_limit": 1, 864 | "http_tokens": "optional" 865 | } 866 | ], 867 | "monitoring": false, 868 | "network_interface": [], 869 | "network_interface_id": null, 870 | "password_data": "", 871 | "placement_group": "", 872 | "primary_network_interface_id": "eni-0865bb546346ee32b", 873 | "private_dns": "ip-172-31-43-244.eu-west-1.compute.internal", 874 | "private_ip": "172.31.43.244", 875 | "public_dns": "ec2-54-72-223-23.eu-west-1.compute.amazonaws.com", 876 | "public_ip": "54.72.223.23", 877 | "root_block_device": [ 878 | { 879 | "delete_on_termination": true, 880 | "device_name": "/dev/xvda", 881 | "encrypted": false, 882 | "iops": 100, 883 | "kms_key_id": "", 884 | "volume_id": "vol-0dc04d972ff05f0d9", 885 | "volume_size": 8, 886 | "volume_type": "gp2" 887 | } 888 | ], 889 | "security_groups": [ 890 | "default" 891 | ], 892 | "source_dest_check": true, 893 | "subnet_id": "subnet-8f2442d5", 894 | "tags": {}, 895 | "tenancy": "default", 896 | "timeouts": null, 897 | "user_data": null, 898 | "user_data_base64": null, 899 | "volume_tags": {}, 900 | "vpc_security_group_ids": [ 901 | "sg-cd637381" 902 | ] 903 | } 904 | }, 905 | { 906 | "address": "aws_instance.this_2", 907 | "mode": "managed", 908 | "type": "aws_instance", 909 | "name": "this_2", 910 | "index": 1, 911 | "provider_name": "aws", 912 | "schema_version": 1, 913 | "values": { 914 | "ami": "ami-06ce3edf0cff21f07", 915 | "arn": "arn:aws:ec2:eu-west-1:052235879155:instance/i-008d0ad2c532d38bb", 916 | "associate_public_ip_address": true, 917 | "availability_zone": "eu-west-1b", 918 | "cpu_core_count": 1, 919 | "cpu_threads_per_core": 1, 920 | "credit_specification": [ 921 | { 922 | "cpu_credits": "standard" 923 | } 924 | ], 925 | "disable_api_termination": false, 926 | "ebs_block_device": [], 927 | "ebs_optimized": false, 928 | "ephemeral_block_device": [], 929 | "get_password_data": false, 930 | "hibernation": false, 931 | "host_id": null, 932 | "iam_instance_profile": "", 933 | "id": "i-008d0ad2c532d38bb", 934 | "instance_initiated_shutdown_behavior": null, 935 | "instance_state": "running", 936 | "instance_type": "t2.nano", 937 | "ipv6_address_count": 0, 938 | "ipv6_addresses": [], 939 | "key_name": "", 940 | "metadata_options": [ 941 | { 942 | "http_endpoint": "enabled", 943 | "http_put_response_hop_limit": 1, 944 | "http_tokens": "optional" 945 | } 946 | ], 947 | "monitoring": false, 948 | "network_interface": [], 949 | "network_interface_id": null, 950 | "password_data": "", 951 | "placement_group": "", 952 | "primary_network_interface_id": "eni-095d5d98876da1e7c", 953 | "private_dns": "ip-172-31-40-29.eu-west-1.compute.internal", 954 | "private_ip": "172.31.40.29", 955 | "public_dns": "ec2-3-250-98-233.eu-west-1.compute.amazonaws.com", 956 | "public_ip": "3.250.98.233", 957 | "root_block_device": [ 958 | { 959 | "delete_on_termination": true, 960 | "device_name": "/dev/xvda", 961 | "encrypted": false, 962 | "iops": 100, 963 | "kms_key_id": "", 964 | "volume_id": "vol-0ffdb5f235660a58e", 965 | "volume_size": 8, 966 | "volume_type": "gp2" 967 | } 968 | ], 969 | "security_groups": [ 970 | "default" 971 | ], 972 | "source_dest_check": true, 973 | "subnet_id": "subnet-8f2442d5", 974 | "tags": {}, 975 | "tenancy": "default", 976 | "timeouts": null, 977 | "user_data": null, 978 | "user_data_base64": null, 979 | "volume_tags": {}, 980 | "vpc_security_group_ids": [ 981 | "sg-cd637381" 982 | ] 983 | } 984 | }, 985 | { 986 | "address": "aws_instance.this_3", 987 | "mode": "managed", 988 | "type": "aws_instance", 989 | "name": "this_3", 990 | "index": "id2", 991 | "provider_name": "aws", 992 | "schema_version": 1, 993 | "values": { 994 | "ami": "ami-06ce3edf0cff21f07", 995 | "arn": "arn:aws:ec2:eu-west-1:052235879155:instance/i-04653b8056614bce0", 996 | "associate_public_ip_address": true, 997 | "availability_zone": "eu-west-1b", 998 | "cpu_core_count": 1, 999 | "cpu_threads_per_core": 1, 1000 | "credit_specification": [ 1001 | { 1002 | "cpu_credits": "standard" 1003 | } 1004 | ], 1005 | "disable_api_termination": false, 1006 | "ebs_block_device": [], 1007 | "ebs_optimized": false, 1008 | "ephemeral_block_device": [], 1009 | "get_password_data": false, 1010 | "hibernation": false, 1011 | "host_id": null, 1012 | "iam_instance_profile": "", 1013 | "id": "i-04653b8056614bce0", 1014 | "instance_initiated_shutdown_behavior": null, 1015 | "instance_state": "running", 1016 | "instance_type": "t2.nano", 1017 | "ipv6_address_count": 0, 1018 | "ipv6_addresses": [], 1019 | "key_name": "", 1020 | "metadata_options": [ 1021 | { 1022 | "http_endpoint": "enabled", 1023 | "http_put_response_hop_limit": 1, 1024 | "http_tokens": "optional" 1025 | } 1026 | ], 1027 | "monitoring": false, 1028 | "network_interface": [], 1029 | "network_interface_id": null, 1030 | "password_data": "", 1031 | "placement_group": "", 1032 | "primary_network_interface_id": "eni-082dad22e1e3eb18e", 1033 | "private_dns": "ip-172-31-42-127.eu-west-1.compute.internal", 1034 | "private_ip": "172.31.42.127", 1035 | "public_dns": "ec2-34-248-151-147.eu-west-1.compute.amazonaws.com", 1036 | "public_ip": "34.248.151.147", 1037 | "root_block_device": [ 1038 | { 1039 | "delete_on_termination": true, 1040 | "device_name": "/dev/xvda", 1041 | "encrypted": false, 1042 | "iops": 100, 1043 | "kms_key_id": "", 1044 | "volume_id": "vol-05f9d25ef617741d2", 1045 | "volume_size": 8, 1046 | "volume_type": "gp2" 1047 | } 1048 | ], 1049 | "security_groups": [ 1050 | "default" 1051 | ], 1052 | "source_dest_check": true, 1053 | "subnet_id": "subnet-8f2442d5", 1054 | "tags": {}, 1055 | "tenancy": "default", 1056 | "timeouts": null, 1057 | "user_data": null, 1058 | "user_data_base64": null, 1059 | "volume_tags": {}, 1060 | "vpc_security_group_ids": [ 1061 | "sg-cd637381" 1062 | ] 1063 | } 1064 | }, 1065 | { 1066 | "address": "aws_instance.this_3", 1067 | "mode": "managed", 1068 | "type": "aws_instance", 1069 | "name": "this_3", 1070 | "index": "id1", 1071 | "provider_name": "aws", 1072 | "schema_version": 1, 1073 | "values": { 1074 | "ami": "ami-06ce3edf0cff21f07", 1075 | "arn": "arn:aws:ec2:eu-west-1:052235879155:instance/i-02a545abba93c4f1e", 1076 | "associate_public_ip_address": true, 1077 | "availability_zone": "eu-west-1b", 1078 | "cpu_core_count": 1, 1079 | "cpu_threads_per_core": 1, 1080 | "credit_specification": [ 1081 | { 1082 | "cpu_credits": "standard" 1083 | } 1084 | ], 1085 | "disable_api_termination": false, 1086 | "ebs_block_device": [], 1087 | "ebs_optimized": false, 1088 | "ephemeral_block_device": [], 1089 | "get_password_data": false, 1090 | "hibernation": false, 1091 | "host_id": null, 1092 | "iam_instance_profile": "", 1093 | "id": "i-02a545abba93c4f1e", 1094 | "instance_initiated_shutdown_behavior": null, 1095 | "instance_state": "running", 1096 | "instance_type": "t2.nano", 1097 | "ipv6_address_count": 0, 1098 | "ipv6_addresses": [], 1099 | "key_name": "", 1100 | "metadata_options": [ 1101 | { 1102 | "http_endpoint": "enabled", 1103 | "http_put_response_hop_limit": 1, 1104 | "http_tokens": "optional" 1105 | } 1106 | ], 1107 | "monitoring": false, 1108 | "network_interface": [], 1109 | "network_interface_id": null, 1110 | "password_data": "", 1111 | "placement_group": "", 1112 | "primary_network_interface_id": "eni-078091a2b07a53835", 1113 | "private_dns": "ip-172-31-38-43.eu-west-1.compute.internal", 1114 | "private_ip": "172.31.38.43", 1115 | "public_dns": "ec2-52-30-16-194.eu-west-1.compute.amazonaws.com", 1116 | "public_ip": "52.30.16.194", 1117 | "root_block_device": [ 1118 | { 1119 | "delete_on_termination": true, 1120 | "device_name": "/dev/xvda", 1121 | "encrypted": false, 1122 | "iops": 100, 1123 | "kms_key_id": "", 1124 | "volume_id": "vol-0cd83ef6e62eafd26", 1125 | "volume_size": 8, 1126 | "volume_type": "gp2" 1127 | } 1128 | ], 1129 | "security_groups": [ 1130 | "default" 1131 | ], 1132 | "source_dest_check": true, 1133 | "subnet_id": "subnet-8f2442d5", 1134 | "tags": {}, 1135 | "tenancy": "default", 1136 | "timeouts": null, 1137 | "user_data": null, 1138 | "user_data_base64": null, 1139 | "volume_tags": {}, 1140 | "vpc_security_group_ids": [ 1141 | "sg-cd637381" 1142 | ] 1143 | } 1144 | } 1145 | ] 1146 | } 1147 | } 1148 | }, 1149 | "configuration": { 1150 | "root_module": { 1151 | "resources": [ 1152 | { 1153 | "address": "aws_instance.this_1", 1154 | "mode": "managed", 1155 | "type": "aws_instance", 1156 | "name": "this_1", 1157 | "provider_config_key": "aws", 1158 | "expressions": { 1159 | "ami": { 1160 | "constant_value": "ami-06ce3edf0cff21f07" 1161 | }, 1162 | "instance_type": { 1163 | "constant_value": "t2.nano" 1164 | } 1165 | }, 1166 | "schema_version": 1 1167 | }, 1168 | { 1169 | "address": "aws_instance.this_2", 1170 | "mode": "managed", 1171 | "type": "aws_instance", 1172 | "name": "this_2", 1173 | "provider_config_key": "aws", 1174 | "expressions": { 1175 | "ami": { 1176 | "constant_value": "ami-06ce3edf0cff21f07" 1177 | }, 1178 | "instance_type": { 1179 | "constant_value": "t2.nano" 1180 | } 1181 | }, 1182 | "schema_version": 1, 1183 | "count_expression": { 1184 | "constant_value": 1 1185 | } 1186 | } 1187 | ] 1188 | } 1189 | } 1190 | } 1191 | -------------------------------------------------------------------------------- /samples/terraform012-state.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 4, 3 | "terraform_version": "0.12.24", 4 | "serial": 5, 5 | "lineage": "b9cbbc57-0c4f-ffcb-e649-fda31b695d6d", 6 | "outputs": {}, 7 | "resources": [ 8 | { 9 | "mode": "managed", 10 | "type": "aws_instance", 11 | "name": "this_1", 12 | "provider": "provider.aws", 13 | "instances": [ 14 | { 15 | "schema_version": 1, 16 | "attributes": { 17 | "ami": "ami-06ce3edf0cff21f07", 18 | "arn": "arn:aws:ec2:eu-west-1:052235879155:instance/i-0ff90abfc4ed5e1ba", 19 | "associate_public_ip_address": true, 20 | "availability_zone": "eu-west-1b", 21 | "cpu_core_count": 1, 22 | "cpu_threads_per_core": 1, 23 | "credit_specification": [ 24 | { 25 | "cpu_credits": "standard" 26 | } 27 | ], 28 | "disable_api_termination": false, 29 | "ebs_block_device": [], 30 | "ebs_optimized": false, 31 | "ephemeral_block_device": [], 32 | "get_password_data": false, 33 | "hibernation": false, 34 | "host_id": null, 35 | "iam_instance_profile": "", 36 | "id": "i-0ff90abfc4ed5e1ba", 37 | "instance_initiated_shutdown_behavior": null, 38 | "instance_state": "running", 39 | "instance_type": "t2.nano", 40 | "ipv6_address_count": 0, 41 | "ipv6_addresses": [], 42 | "key_name": "", 43 | "metadata_options": [ 44 | { 45 | "http_endpoint": "enabled", 46 | "http_put_response_hop_limit": 1, 47 | "http_tokens": "optional" 48 | } 49 | ], 50 | "monitoring": false, 51 | "network_interface": [], 52 | "network_interface_id": null, 53 | "password_data": "", 54 | "placement_group": "", 55 | "primary_network_interface_id": "eni-002eab501459346af", 56 | "private_dns": "ip-172-31-44-202.eu-west-1.compute.internal", 57 | "private_ip": "172.31.44.202", 58 | "public_dns": "ec2-52-50-132-229.eu-west-1.compute.amazonaws.com", 59 | "public_ip": "52.50.132.229", 60 | "root_block_device": [ 61 | { 62 | "delete_on_termination": true, 63 | "device_name": "/dev/xvda", 64 | "encrypted": false, 65 | "iops": 100, 66 | "kms_key_id": "", 67 | "volume_id": "vol-082792576e14c7035", 68 | "volume_size": 8, 69 | "volume_type": "gp2" 70 | } 71 | ], 72 | "security_groups": [ 73 | "default" 74 | ], 75 | "source_dest_check": true, 76 | "subnet_id": "subnet-8f2442d5", 77 | "tags": {}, 78 | "tenancy": "default", 79 | "timeouts": null, 80 | "user_data": null, 81 | "user_data_base64": null, 82 | "volume_tags": {}, 83 | "vpc_security_group_ids": [ 84 | "sg-cd637381" 85 | ] 86 | }, 87 | "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwidXBkYXRlIjo2MDAwMDAwMDAwMDB9LCJzY2hlbWFfdmVyc2lvbiI6IjEifQ==" 88 | } 89 | ] 90 | }, 91 | { 92 | "mode": "managed", 93 | "type": "aws_instance", 94 | "name": "this_2", 95 | "each": "list", 96 | "provider": "provider.aws", 97 | "instances": [ 98 | { 99 | "index_key": 0, 100 | "schema_version": 1, 101 | "attributes": { 102 | "ami": "ami-06ce3edf0cff21f07", 103 | "arn": "arn:aws:ec2:eu-west-1:052235879155:instance/i-0beba2f332faca794", 104 | "associate_public_ip_address": true, 105 | "availability_zone": "eu-west-1b", 106 | "cpu_core_count": 1, 107 | "cpu_threads_per_core": 1, 108 | "credit_specification": [ 109 | { 110 | "cpu_credits": "standard" 111 | } 112 | ], 113 | "disable_api_termination": false, 114 | "ebs_block_device": [], 115 | "ebs_optimized": false, 116 | "ephemeral_block_device": [], 117 | "get_password_data": false, 118 | "hibernation": false, 119 | "host_id": null, 120 | "iam_instance_profile": "", 121 | "id": "i-0beba2f332faca794", 122 | "instance_initiated_shutdown_behavior": null, 123 | "instance_state": "running", 124 | "instance_type": "t2.nano", 125 | "ipv6_address_count": 0, 126 | "ipv6_addresses": [], 127 | "key_name": "", 128 | "metadata_options": [ 129 | { 130 | "http_endpoint": "enabled", 131 | "http_put_response_hop_limit": 1, 132 | "http_tokens": "optional" 133 | } 134 | ], 135 | "monitoring": false, 136 | "network_interface": [], 137 | "network_interface_id": null, 138 | "password_data": "", 139 | "placement_group": "", 140 | "primary_network_interface_id": "eni-0865bb546346ee32b", 141 | "private_dns": "ip-172-31-43-244.eu-west-1.compute.internal", 142 | "private_ip": "172.31.43.244", 143 | "public_dns": "ec2-54-72-223-23.eu-west-1.compute.amazonaws.com", 144 | "public_ip": "54.72.223.23", 145 | "root_block_device": [ 146 | { 147 | "delete_on_termination": true, 148 | "device_name": "/dev/xvda", 149 | "encrypted": false, 150 | "iops": 100, 151 | "kms_key_id": "", 152 | "volume_id": "vol-0dc04d972ff05f0d9", 153 | "volume_size": 8, 154 | "volume_type": "gp2" 155 | } 156 | ], 157 | "security_groups": [ 158 | "default" 159 | ], 160 | "source_dest_check": true, 161 | "subnet_id": "subnet-8f2442d5", 162 | "tags": {}, 163 | "tenancy": "default", 164 | "timeouts": null, 165 | "user_data": null, 166 | "user_data_base64": null, 167 | "volume_tags": {}, 168 | "vpc_security_group_ids": [ 169 | "sg-cd637381" 170 | ] 171 | }, 172 | "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwidXBkYXRlIjo2MDAwMDAwMDAwMDB9LCJzY2hlbWFfdmVyc2lvbiI6IjEifQ==" 173 | } 174 | ] 175 | } 176 | ] 177 | } 178 | -------------------------------------------------------------------------------- /terraform.jq: -------------------------------------------------------------------------------- 1 | # This jq-file extracts cost keys from given Terraform file (plan as json and any version of Terraform state). 2 | # 3 | # jq version 1.6 or newer is required. 4 | # 5 | # Repository: https://github.com/antonbabenko/terraform-cost-estimation 6 | # License: MIT 7 | 8 | def debug($msg): $msg | debug | empty; 9 | def outline($msg): "---> \($msg)"; 10 | 11 | def isnull: . == null; 12 | def isstr: type == "string"; 13 | def isarray: type == "array"; 14 | def isobject: type == "object"; 15 | def isiterable: type|. == "array" or . == "object"; 16 | def isblankstr: type == "string" and . == ""; 17 | def isblank: isiterable and (.|length) == 0; 18 | def isidle: isnull or isblankstr or isblank; 19 | def idle_paths: [path(..|select(isidle))]; 20 | def del_nulls: delpaths([paths(isnull)]); 21 | def del_blanks: delpaths([paths(isblank)]); 22 | def del_idles: delpaths(idle_paths); 23 | def del_idles_recursive: 24 | walk(if isidle then . elif isiterable then delpaths([paths(isidle)]) else . end); 25 | def getpaths(PATHS): . as $in | reduce PATHS[] as $p ({}; .[$p[0]] = ($in | getpath($p))); 26 | def uniq: reduce .[] as $x ([]; if . | contains([$x]) | not then . + [$x] else . end); 27 | def insideof($g): . as $i| $g | map(.==$i) | any; 28 | def valid(exp): exp | if . == null then empty else . end; 29 | def mul: reduce .[] as $x(1; .*$x); 30 | def array_mul_tail: [.[0],(.[1:]|mul)]; 31 | def array_group_sum: 32 | group_by(.[0]) as $x|[$x[]|reduce .[] as $x(["", 0]; [$x[0], .[1]+$x[1]])] 33 | ; 34 | def pack_cost_keys: map(join("|")); 35 | def compact_cost_keys: 36 | sort_by(.[0]) | array_group_sum | pack_cost_keys 37 | ; 38 | 39 | # Scoping wraper 40 | # - Wraps an expression to the try..catch sentence 41 | # and prepends error orriginal error with a mesage prefix. 42 | def XX(msg; exp): 43 | try exp catch if test("->") 44 | then error("\n⭣ \(msg)\(.)") 45 | else error("\n ↘ \(msg) -> \(.)") end 46 | ; 47 | 48 | def vars: { 49 | platform: "linux", 50 | ec2_prefix: "ec2", 51 | fallback_region: ($ENV.AWS_DEFAULT_REGION // $ENV.AWS_REGION // "eu-west-1") 52 | }; 53 | 54 | def group_resources: 55 | group_by(.)[]|[.[0], (.|length)] | join("|") 56 | ; 57 | 58 | def group_and_sum: 59 | reduce .[] as $x ( 60 | {}; if .[$x[0]] == null 61 | then .[$x[0]]=$x[1] 62 | else .[$x[0]]+=$x[1] end) 63 | ; 64 | 65 | def parse_arn: 66 | split(":")[3] # Take region 67 | ; 68 | 69 | def get_cost_keys_from_ec2_instances: 70 | vars as $v 71 | | { 72 | region: (.arn | parse_arn? // $v.fallback_region), 73 | tenancy: (if .tenancy != "dedicated" then "shared" else . end), 74 | instance_type, 75 | capacity: (.capacity // 1), 76 | } 77 | ; 78 | 79 | def construct_ec2_cost_key: 80 | vars as $v 81 | |[ ([ 82 | $v.ec2_prefix 83 | , .region 84 | , .instance_type 85 | , .tenancy 86 | , $v.platform 87 | ] 88 | | join("#") 89 | | ascii_downcase) 90 | , .capacity 91 | ] #| join("|") 92 | ; 93 | 94 | def extract_ec2_cost_info: 95 | get_cost_keys_from_ec2_instances 96 | | construct_ec2_cost_key 97 | ; 98 | 99 | def get_cost_keys_from_gpu_instances: 100 | vars as $v 101 | |{ 102 | region: (.arn | parse_arn? // $v.fallback_region), 103 | gpu_type: .elastic_gpu_specifications[].type, 104 | capacity: (.capacity // 1), 105 | instance_type, 106 | id, 107 | } 108 | ; 109 | 110 | def construct_gpu_cost_key: 111 | vars as $v 112 | |[ ([ 113 | $v.ec2_prefix 114 | , .region 115 | , .gpu_type 116 | ] 117 | | join("#") 118 | | ascii_downcase) 119 | , .capacity 120 | ] #| join("|") 121 | ; 122 | 123 | def extract_gpu_cost_info: 124 | get_cost_keys_from_gpu_instances 125 | | construct_gpu_cost_key 126 | ; 127 | 128 | 129 | def aws: 130 | ################################################################# Guards 131 | def exists(pth): 132 | if pth != null then 133 | pth 134 | else 135 | . as $i | 136 | path(pth) as $p | 137 | $p | join(".") as $d | 138 | $i | getpath($p[:-1])|keys|join(", ") as $t | 139 | error("Path \".\($d)\" doesn't found in a json file.\n" 140 | + "Same level keys: \($t)") 141 | end 142 | ; 143 | 144 | ################################################################# Adapters 145 | def tf_lt_12_adapter: 146 | XX("tf_lt_12_adapter"; 147 | [ .modules[].resources 148 | | if . == null then empty else . end 149 | | to_entries 150 | | .[] 151 | | { name: .key, 152 | type: .value.type, 153 | instances:[.value.primary + {dependencies:.value.depends_on}] 154 | } 155 | ] 156 | ); 157 | 158 | ################################################################# Data shapers 159 | def clear_io(expr): 160 | XX("clear_io"; 161 | del_idles_recursive | [expr | del_idles_recursive] 162 | ); 163 | 164 | def shape_attributes: 165 | XX("shape_attributes"; 166 | { 167 | id, arn, instance_type, 168 | # Autoscaling groups specific 169 | min_size, spot_price, desired_capacity, 170 | # LB specific 171 | load_balancer_type, 172 | # Launch templates and configuration specific 173 | launch_configuration, 174 | launch_template: [.launch_template[]? // {} | {id}], 175 | launch_template_config: 176 | [.launch_template_config[]? // {} | { 177 | launch_template_specification: 178 | [.launch_template_specification[]? // {} | { 179 | launch_template_id 180 | }] 181 | }], 182 | # GPU specific 183 | elastic_gpu_specifications: 184 | [.elastic_gpu_specifications[]? // {} | {type}], 185 | # EC2 fleet specific 186 | target_capacity_specification: 187 | [.target_capacity_specification[]? // {} | { 188 | default_target_capacity_type, 189 | total_target_capacity, 190 | }], 191 | # EBS specific 192 | device_name, 193 | volume_size, 194 | volume_type, 195 | iops, 196 | type, 197 | size, 198 | source_region, 199 | } 200 | ); 201 | 202 | def shape_resources(root): 203 | XX("shape_resources"; 204 | root | 205 | { #"module", mode, each, name, 206 | type, provider, 207 | instances: [.instances[]? // {} | { 208 | attributes: .attributes | shape_attributes, 209 | #dependencies, 210 | }] 211 | } 212 | ); 213 | 214 | def shape_resource_changes(root): 215 | XX("shape_resource_changes"; 216 | root | 217 | { "module", mode, each, name, address, 218 | type, provider_name, 219 | change: .change | { 220 | before: .before | shape_attributes, 221 | after: .after | shape_attributes 222 | }, 223 | } 224 | ); 225 | 226 | ################################################################# Data extractors 227 | def extract_resources: 228 | XX("extract_resources"; 229 | if .modules then clear_io(shape_resources(tf_lt_12_adapter[])) 230 | elif .resources then clear_io(shape_resources(.resources[]?)) 231 | else error("Can't read resources") 232 | end 233 | ); 234 | 235 | def extract_resource_changes: 236 | XX("extract_resource_changes"; 237 | if .resource_changes then clear_io(shape_resource_changes(.resource_changes[])) 238 | else error("Can't read resource_changes") 239 | end 240 | ); 241 | 242 | def aws_ebs_block_devices(attr; inst): 243 | def extract(cond; cost_type): 244 | vars as $v | 245 | map(select(cond))[] 246 | | . as $r 247 | | inst 248 | | if (type| . == "object") then [.] else . end # hack for plans 249 | |. [] | attr 250 | | { region: (.arn | parse_arn? // $v.fallback_region), 251 | cost_type: cost_type, 252 | type: $r.type, 253 | volume_size: (.volume_size // 0), 254 | size: (.size // 0), 255 | iops: (.iops // 0), 256 | source_region: (.source_region // $v.fallback_region), 257 | } 258 | ; 259 | XX("aws_ebs_block_devices"; 260 | [( 261 | extract(.type == "aws_ebs_snapshot"; "snapshot"), 262 | extract(.type == "aws_ebs_snapshot_copy"; "snapshot"), 263 | extract(.type == "aws_ebs_volume"; 264 | if .type == "standard" then "standard" 265 | elif .type == "io1" then "io1" 266 | else "gp2" end) 267 | ) | ( 268 | if .type == "aws_ebs_snapshot" then 269 | ["ec2#\(.region)#\(.cost_type)", .volume_size] 270 | elif .type == "aws_ebs_snapshot_copy" then 271 | ["ec2#\(.source_region)#\(.cost_type)", .volume_size] 272 | elif .type == "aws_ebs_volume" then ( 273 | if .cost_type == "io1" then 274 | ["ec2#\(.region)#\(.cost_type)", .size], 275 | ["ec2#\(.region)#piops", .iops] 276 | else 277 | ["ec2#\(.region)#\(.cost_type)", .size] 278 | end 279 | ) 280 | else ["ec2#\(.region)#\(.cost_type)", .size] 281 | end 282 | ) 283 | ] 284 | ); 285 | 286 | def aws_ec2_fleet(attr; inst): 287 | XX("aws_ec2_fleet"; 288 | [ map(select(.type == "aws_ec2_fleet" and inst))[] // {} 289 | | (inst // {}) 290 | | if (type | . == "object") then [.] else . end # hack for plans 291 | | map(attr)[] // {} 292 | | select( # Common filtration on instances level 293 | .target_capacity_specification[]? 294 | | .default_target_capacity_type == "on-demand" 295 | and .total_target_capacity > 0 296 | ) 297 | | [ .target_capacity_specification[]? # Gathering all capacities 298 | | select(.default_target_capacity_type == "on-demand" 299 | and .total_target_capacity > 0) 300 | | .total_target_capacity 301 | ] as $capacities 302 | | .launch_template_config[]? // {} 303 | | .launch_template_specification[]? // {} 304 | | {launch_template_id, capacity: $capacities | add} 305 | #| {(.launch_template_id): .capacity} 306 | | [.launch_template_id, .capacity] 307 | | select(.[0] != null) 308 | ] | group_and_sum 309 | ); 310 | 311 | def aws_instance(attr; inst): 312 | XX("aws_instance"; 313 | [ map(select(.type == "aws_instance" and inst))[] // empty 314 | | inst // {} 315 | | if (type| . == "object") then [.] else . end # hack for plans 316 | ] | add // [] 317 | | map(attr) 318 | | map(if . == null then empty else . end) 319 | ); 320 | 321 | def aws_autoscaling_group(inst): 322 | XX("aws_autoscaling_group"; 323 | #select(contains({type: "aws_autoscaling_group"})) 324 | map(select(.type == "aws_autoscaling_group" and inst)) 325 | ); 326 | 327 | def ag_filter(attr): 328 | XX("ag_filter"; 329 | # Filtration of autoscaling groups that doesn't fit. 330 | map(select( 331 | attr.desired_capacity>=1 332 | or attr.min_size>=1 333 | or attr.spot_price 334 | )) 335 | ); 336 | 337 | def ag_instances(attr; inst): 338 | XX("ag_instances"; 339 | [ .[] 340 | | inst 341 | | if (type| . == "object") then [.] else . end # hack for plans 342 | ] | (add // []) 343 | ); 344 | 345 | def ag_instances_with_lt(attr): 346 | XX("ag_instances_with_lt"; 347 | map(select(attr.launch_template)) 348 | ); 349 | 350 | def ag_instances_with_lc(attr): 351 | XX("ag_instances_with_lc"; 352 | map(select(attr.launch_configuration)) 353 | ); 354 | 355 | def lt_ids(attr): 356 | XX("lt_ids"; 357 | [.[] | attr.launch_template[].id] | uniq 358 | ); 359 | 360 | def lc_ids(attr): 361 | XX("lc_ids"; 362 | [.[] | attr.launch_configuration] | uniq 363 | ); 364 | 365 | def desired_capacities(attr; inst): 366 | XX("desired_capacities"; 367 | [ .[] | inst 368 | | if (type| . == "object") then [.] else . end # hack for plans 369 | | .[] | attr as $a | $a 370 | | [.launch_configuration? // (.launch_template? // [] | .[].id)] #as $ids 371 | | .[] | [., ($a.desired_capacity | if . == 0 then $a.min_size // 0 else . end)] 372 | ] | group_and_sum # => {launch_..._id: total_desired_capacity} 373 | ); 374 | 375 | def aws_launch_template(inst): 376 | XX("aws_launch_template"; 377 | map(select(.type == "aws_launch_template" and inst)) 378 | ); 379 | 380 | def aws_launch_configuration(inst): 381 | XX("aws_launch_configuration"; 382 | map(select(.type == "aws_launch_configuration" and inst)) 383 | ); 384 | 385 | def launch_instances($ids; attr; inst): 386 | XX("launch_instances"; 387 | [[.[] | inst 388 | | if (type | . == "object") then [.] else . end # hack for plans 389 | ] | (add // [])[] | select(attr.id|insideof($ids))] 390 | | map(attr) # Reduce depth 391 | ); 392 | 393 | def bind_capacities($caps): 394 | XX("bind_capabilities"; 395 | [.[] | . + {capacity: $caps[.id]}] 396 | ); 397 | 398 | ################################################################# Compute costs funcs 399 | def cost_instances: 400 | XX("cost_instances"; 401 | map(extract_ec2_cost_info) 402 | ); 403 | 404 | def cost_gpus: 405 | XX("cost_gpus"; 406 | map(extract_gpu_cost_info) 407 | ); 408 | 409 | def aws_loadbalancers(attr; inst): 410 | def extract(cond; _type): 411 | vars as $v | 412 | map(select(cond))[] 413 | | valid(inst) 414 | | if (type | . == "object") then [.] else . end # hack for plans 415 | | .[] | attr 416 | | { region: (.arn | parse_arn? // $v.fallback_region), 417 | type: _type} 418 | ; 419 | XX("aws_loadbalancers"; 420 | [( 421 | extract(.type == "aws_lb" or .type == "aws_alb"; 422 | if .load_balancer_type == "network" then "nlb" else "alb" end), 423 | extract(.type == "aws_elb"; "elb"), 424 | extract(.type == "aws_nat_gateway"; "nat") 425 | ) | ["ec2#\(.region)#\(.type)", 1]] 426 | #| group_resources 427 | ); 428 | 429 | ################################################################# Process data 430 | def process_resources(attr; inst): 431 | XX("process_resources"; 432 | . as $r | 433 | aws_instance(attr; inst) as $ai | 434 | aws_autoscaling_group(inst) as $ag | 435 | ($ag | ag_instances(attr; inst) 436 | | ag_filter(attr)) as $agi | 437 | ($agi | ag_instances_with_lt(attr)) as $ilt | 438 | ($agi | ag_instances_with_lc(attr)) as $ilc | 439 | ($ilt | lt_ids(attr)) as $lti | 440 | ($ilc | lc_ids(attr)) as $lci | 441 | ($ag | desired_capacities(attr; inst)) as $dc | 442 | (aws_launch_template(inst)) as $lt | 443 | ($lt | launch_instances($lti; attr; inst) 444 | | bind_capacities($dc)) as $lt_ins | 445 | (aws_launch_configuration(inst)) as $lc | 446 | ($lc | launch_instances($lci; attr; inst) 447 | | bind_capacities($dc)) as $lc_ins | 448 | aws_ec2_fleet(attr; inst) as $af | 449 | ($lt | launch_instances(($af|keys); attr; inst) 450 | | bind_capacities($af)) as $af_ins | 451 | ################################################################ Compute costs 452 | ($ai | cost_instances) as $cai | 453 | ($lt_ins | cost_instances) as $clti | 454 | ($lt_ins | cost_gpus) as $cgti | 455 | ($lc_ins | cost_instances) as $clci | 456 | ($lc_ins | cost_gpus) as $cgci | 457 | ($af_ins | cost_instances) as $cafi | 458 | aws_loadbalancers(attr; inst) as $lb | 459 | aws_ebs_block_devices(attr; inst) as $ebs | 460 | ($cai + $clti + $cgti + $clci + $cgci + $lb + $cafi + $ebs) as $ck 461 | ############################################################### Result object 462 | | { 463 | resources: $r, 464 | instances: $ai, 465 | autoscaling_groups: { 466 | groups: $ag, 467 | instances: { 468 | all: $agi, 469 | lt: { 470 | instances: $ilt, 471 | ids: $lti, 472 | }, 473 | lc: { 474 | instances: $ilc, 475 | ids: $lci, 476 | }, 477 | }, 478 | capacities: $dc, 479 | }, 480 | ec2_fleets: { 481 | capacities: $af, 482 | instances: $af_ins, 483 | }, 484 | launch_template: { 485 | instances: $lt_ins, 486 | }, 487 | launch_configuration: { 488 | instances: $lc_ins, 489 | }, 490 | cost: { 491 | loadbalancers: $lb | pack_cost_keys, 492 | instances: $cai | pack_cost_keys, 493 | ec2_fleet: { 494 | instances: $cafi | pack_cost_keys, 495 | }, 496 | launch_template: { 497 | instances: $clti | pack_cost_keys, 498 | gpu_instances: $cgti | pack_cost_keys, 499 | }, 500 | launch_configuration: { 501 | instances: $clci | pack_cost_keys, 502 | gpu_instances: $cgci | pack_cost_keys, 503 | }, 504 | block_devices: $ebs | pack_cost_keys, 505 | keys: $ck | compact_cost_keys, 506 | }, 507 | } 508 | ); 509 | 510 | def process_resource_changes: 511 | XX("process_resource_changes"; 512 | . as $r | $r 513 | | XX("# before"; process_resources(.change.before; .)) as $before 514 | | XX("# after"; process_resources(.change.after; .)) as $after 515 | | { 516 | #before: $before | del_idles_recursive, 517 | #after: $after | del_idles_recursive, 518 | cost: { 519 | loadbalancers: { 520 | before: $before.cost.loadbalancers, 521 | after: $after.cost.loadbalancers, 522 | }, 523 | instances: { 524 | before: $before.cost.instances, 525 | after: $after.cost.instances, 526 | }, 527 | ec2_fleet: { 528 | before: $before.cost.ec2_fleet, 529 | after: $after.cost.ec2_fleet, 530 | }, 531 | launch_template: { 532 | before: $before.cost.launch_template, 533 | after: $after.cost.launch_template, 534 | }, 535 | launch_configuration: { 536 | before: $before.cost.launch_configuration, 537 | after: $after.cost.launch_configuration, 538 | }, 539 | block_devices: { 540 | before: $before.cost.block_devices, 541 | after: $after.cost.block_devices, 542 | }, 543 | keys: { 544 | before: $before.cost.keys, 545 | after: $after.cost.keys, 546 | } 547 | } 548 | } 549 | ); 550 | 551 | def process: 552 | XX("process"; 553 | try 554 | if .modules or .resources then 555 | extract_resources | process_resources(.attributes; .instances) 556 | elif .resource_changes then 557 | . | extract_resource_changes | process_resource_changes 558 | else error("- Unknown tfstate/plan json file structure") 559 | end 560 | catch if test("^[⭣-]") 561 | then error(.) 562 | else error("Json input isn't an object") 563 | end 564 | ); 565 | 566 | XX("aws"; 567 | process 568 | ) 569 | ; 570 | 571 | def AWS: 572 | ############################################################### Shortcuts object 573 | aws | 574 | { 575 | r: .resources, 576 | i: .instances, 577 | f: .ec2_fleets, 578 | lt: .launch_template, 579 | lc: .launch_configuration, 580 | ag: .autoscaling_groups, 581 | c: .cost, 582 | } 583 | ; 584 | 585 | def meta: { 586 | terraform_version, 587 | format_version, 588 | version 589 | }; 590 | 591 | def version: "0.2.3"; 592 | 593 | def parse: { 594 | version: version, 595 | meta: meta, 596 | keys: aws.cost.keys, 597 | }; 598 | 599 | 600 | empty 601 | , parse 602 | , if $ARGS.named.extra != null then 603 | outline("Extra info") 604 | , aws 605 | else empty 606 | end 607 | 608 | # vim:ts=4:sw=4:et 609 | --------------------------------------------------------------------------------