diff --git a/.circleci/config.yml b/.circleci/config.yml index a940910..c952b54 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,8 +5,8 @@ jobs: # Automated Tests # test-static-code-and-linting: - machine: - image: ubuntu-1604:202007-01 # Ubuntu 16.04, Docker v19.03.12, Docker Compose v1.26.1 + machine: # https://circleci.com/docs/2.0/configuration-reference/#available-machine-images + image: ubuntu-2004:202107-01 # Ubuntu 16.04, Docker v19.03.12, Docker Compose v1.26.1 # This job has been blocked because Docker Layer Caching is not available on your plan. # Should upgrade if necessary. @@ -26,14 +26,15 @@ jobs: git update-index --assume-unchanged "Makefile" - run: - name: test-terraform-format-and-docs + name: test-dependencies command: | # # Install pre-commit - pip install pre-commit + sudo -H pip3 install pre-commit # # Install terraform - sudo apt-get install unzip + sudo apt-get install unzip curl + curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - wget https://releases.hashicorp.com/terraform/${TERRAFORM_VER}/terraform_${TERRAFORM_VER}_linux_amd64.zip unzip terraform_${TERRAFORM_VER}_linux_amd64.zip sudo mv terraform /usr/local/bin/ @@ -41,16 +42,17 @@ jobs: # # Install terraform-docs sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" - curl -Lo ./terraform-docs https://github.com/terraform-docs/terraform-docs/releases/download/v0.10.1/terraform-docs-v0.10.1-$(uname | tr '[:upper:]' '[:lower:]')-amd64 + curl -Lo ./terraform-docs https://github.com/terraform-docs/terraform-docs/releases/download/v0.12.1/terraform-docs-v0.12.1-$(uname | tr '[:upper:]' '[:lower:]')-amd64 chmod +x ./terraform-docs sudo mv ./terraform-docs /usr/local/bin/terraform-docs - # - # Run tests - make pre-commit + + - run: + name: test-terraform-format-and-docs + command: make pre-commit - run: name: Install awscli - command: sudo -H pip install awscli + command: sudo -H pip3 install awscli - run: name: Configure awscli @@ -77,122 +79,6 @@ jobs: name: test-terraform-linting command: make tflint-deep - - slack/notify: - event: fail - mentions: '@leverage-support' - custom: | - { - "blocks": [ - { - "type": "header", - "text": { - "type": "plain_text", - "text": "Failed Pipeline! :rotating_light::fire::bash-fire::bangbang::video-games-doom-mad::stopp:", - "emoji": true - } - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": ":negative_squared_cross_mark: *Project*: $CIRCLE_PROJECT_REPONAME \n :negative_squared_cross_mark: *User*: $CIRCLE_USERNAME \n :negative_squared_cross_mark: *Job*: $CIRCLE_JOB in *repo* $CIRCLE_PROJECT_REPONAME \n :negative_squared_cross_mark: *Branch:* $CIRCLE_BRANCH \n :negative_squared_cross_mark: *PR:* $CIRCLE_PULL_REQUEST \n :negative_squared_cross_mark: *Last Commit:* $CIRCLE_SHA1" - }, - "accessory": { - "type": "button", - "text": { - "type": "plain_text", - "text": ":arrow_forward: View Job in CircleCi", - "emoji": true - }, - "value": "click_me_123", - "url": "$CIRCLE_BUILD_URL", - "action_id": "button-action" - } - } - ] - } - channel: 'tools-ci' - - slack/notify: - event: pass - custom: | - { - "blocks": [ - { - "type": "header", - "text": { - "type": "plain_text", - "text": "Successful Pipeline! :checkered_flag: :video-games-star: :video-games-mario-luigi-dance: :tada: :binbash::bb-leverage: :heart: :open-source:", - "emoji": true - } - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": ":heavy_check_mark: *Project*: $CIRCLE_PROJECT_REPONAME \n :heavy_check_mark: *User*: $CIRCLE_USERNAME \n :heavy_check_mark: *Job*: $CIRCLE_JOB in *repo* $CIRCLE_PROJECT_REPONAME \n :heavy_check_mark: *Branch:* $CIRCLE_BRANCH \n :heavy_check_mark: *PR:* $CIRCLE_PULL_REQUEST \n :heavy_check_mark: *Last Commit:* $CIRCLE_SHA1" - }, - "accessory": { - "type": "button", - "text": { - "type": "plain_text", - "text": ":arrow_forward: View Job in CircleCi", - "emoji": true - }, - "value": "click_me_123", - "url": "$CIRCLE_BUILD_URL", - "action_id": "button-action" - } - } - ] - } - channel: 'tools-ci' - - # - # Tests E2E - # - test-e2e-terratests: - machine: - image: ubuntu-1604:202007-01 - docker_layer_caching: false - - steps: - - checkout - - - run: - name: Context Info Cmds - command: pwd && ls -ltra && git branch - - - run: - name: Initialize Repo Makefiles - command: | - make init-makefiles - git update-index --assume-unchanged "Makefile" - - - run: - name: Install awscli - command: sudo pip install awscli - - - run: - name: Configure awscli - command: | - # AWS defautl awscli profile - aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID - aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY - aws configure set region us-east-1 - aws configure set output json - - # AWS dev awscli profile - aws configure set role_arn arn:aws:iam::$AWS_ACCOUNT_ID_SHARED:role/DeployMaster --profile $AWS_PROFILE_NAME - aws configure set source_profile default --profile $AWS_PROFILE_NAME - # moving credentials to specific project folder - mkdir --parents /home/circleci/.aws/bb - cp /home/circleci/.aws/credentials /home/circleci/.aws/bb/credentials - cp /home/circleci/.aws/config /home/circleci/.aws/bb/config - - - run: - name: Test AWS permissions - command: aws ec2 describe-instances --region us-east-1 --profile $AWS_PROFILE_NAME - - run: name: test-terratests-dep-init command: make terratest-dep-init @@ -276,7 +162,7 @@ jobs: # release-version-with-changelog: machine: - image: ubuntu-1604:202007-01 + image: ubuntu-2004:202107-01 # Ubuntu 16.04, Docker v19.03.12, Docker Compose v1.26.1 docker_layer_caching: false environment: @@ -402,14 +288,8 @@ workflows: context: binbashar-org-global-context filters: branches: - ignore: # only branches matching the below regex filters will run - - master - - test-e2e-terratests: - context: binbashar-org-global-context - filters: - branches: - ignore: # only branches matching the below regex filters will run - - master + ignore: # only branches matching the below regex filters will run + - master - release-version-with-changelog: context: binbashar-org-global-context filters: diff --git a/.gitignore b/.gitignore index 13d59e5..7a6daf3 100644 --- a/.gitignore +++ b/.gitignore @@ -99,6 +99,13 @@ Thumbs.db *.tfstate *.tfstate.backup # +# Ignore override files as they are usually used to override resources locally and so +# are not checked in +override.tf +override.tf.json +*_override.tf +*_override.tf.json +# # Module directory # .terraform diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..808ecf3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2017-2018 Cloud Posse, LLC + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index 3699d6f..0000000 --- a/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -### The MIT License (MIT) - -Copyright (c) 2020 Binbashar Inc - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/Makefile b/Makefile index 761f3bc..20aaca8 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ SHELL := /bin/bash MAKEFILE_PATH := ./Makefile MAKEFILES_DIR := ./@bin/makefiles -MAKEFILES_VER := v0.1.5 +MAKEFILES_VER := v0.1.33 help: @echo 'Available Commands:' @@ -19,5 +19,7 @@ init-makefiles: ## initialize makefiles -include ${MAKEFILES_DIR}/circleci/circleci.mk -include ${MAKEFILES_DIR}/release-mgmt/release.mk --include ${MAKEFILES_DIR}/terraform13/terraform13.mk --include ${MAKEFILES_DIR}/terratest13/terratest13.mk +-include ${MAKEFILES_DIR}/terraform14/terraform14-root-context.mk +-include ${MAKEFILES_DIR}/terraform14/terraform14.mk +-include ${MAKEFILES_DIR}/terratest14/terratest14.mk + diff --git a/README.md b/README.md index 6428f31..c61663d 100644 --- a/README.md +++ b/README.md @@ -35,65 +35,88 @@ Personally we have seen the need of creating a similar set of such resources | Name | Version | |------|---------| -| terraform | >= 0.13.2 | -| aws | ~> 3.0 | +| [terraform](#requirement\_terraform) | >= 0.13.2 | +| [aws](#requirement\_aws) | ~> 3.0 | ## Providers | Name | Version | |------|---------| -| aws | ~> 3.0 | +| [aws](#provider\_aws) | ~> 3.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [aws_eip.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip) | resource | +| [aws_iam_instance_profile.basic_instance](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_instance_profile) | resource | +| [aws_iam_policy.cross_org_instance_access](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | +| [aws_iam_role.basic_instance_assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource | +| [aws_iam_role_policy_attachment.basic_instance_aws_roles](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | +| [aws_iam_role_policy_attachment.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | +| [aws_instance.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance) | resource | +| [aws_route53_record.main_private](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource | +| [aws_route53_record.main_public](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource | +| [aws_security_group.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource | +| [aws_security_group_rule.egress_allow_all](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource | +| [aws_security_group_rule.ingress_rules](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource | +| [aws_ami.ubuntu_linux](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami) | data source | +| [aws_iam_policy_document.cross_org_instance_access](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | +| [aws_iam_policy_document.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | ## Inputs | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| ami\_id | AMI Identifier | `string` | `""` | no | -| associate\_public\_ip\_address | Associate a public IP address with the instance | `bool` | `false` | no | -| aws\_ami\_os\_id | AWS AMI Operating System Identificator | `string` | `"ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-*"` | no | -| aws\_ami\_os\_owner | AWS AMI Operating System Owner, eg: 099720109477 for Canonical | `string` | `"099720109477"` | no | -| credit\_specification\_cpu | Can be applied/modified to the EC2 at any time. The credit option for CPU usage. Can be 'standard' or 'unlimited'. By default T3 = unlimited & T2 'standard'. | `string` | `"unlimited"` | no | -| cross\_account\_roles\_resource\_arn\_list | Resources arn list for cross org roles for EC2 profile IAM Role policy. | `list(string)` | `[]` | no | -| disable\_api\_termination | If true, enables EC2 Instance Termination Protection | `string` | `"false"` | no | -| dns\_records\_internal\_hosted\_zone | A list of DNS private (internal hosted zone) records to create with the instance's IP | `list(any)` | `[]` | no | -| dns\_records\_public\_hosted\_zone | A list of DNS public (public hosted zone) records to create with the instance's IP | `list(any)` | `[]` | no | -| ebs\_block\_device | Additional EBS block devices to attach to the instance | `list(map(string))` | `[]` | no | -| ebs\_optimized | Enable EBS Optimized | `string` | `"false"` | no | -| ephemeral\_block\_device | Customize Ephemeral (also known as Instance Store) volumes on the instance | `list(map(string))` | `[]` | no | -| instance\_profile | The IAM Instance Profile to launch the instance with. Specified as the name of the Instance Profile. | `string` | `""` | no | -| instance\_type | EC2 Instance Type | `string` | `"t3.micro"` | no | -| key\_pair\_name | Key Pair Name | `string` | n/a | yes | -| monitoring | If true, the launched EC2 instance will have detailed monitoring enabled | `bool` | `false` | no | -| name | Name | `string` | n/a | yes | -| policy\_arn | Attach AWS IAM managed policies to the IAM Role. | `list(string)` | `[]` | no | -| prefix | Prefix | `string` | `"default"` | no | -| root\_block\_device | Customize details about the root block device of the instance. See Block Devices below for details | `list(map(string))` | `[]` | no | -| root\_device\_backup\_tag | EC2 Root Block Device backup tag | `string` | `"True"` | no | -| security\_group\_rules | A list of security group rules | `list(any)` | `[]` | no | -| subnet\_id | Subnet ID | `string` | n/a | yes | -| tag\_approved\_ami\_value | Set the specific tag ApprovedAMI ('true' \| 'false') that identifies aws-config compliant AMIs | `string` | `"false"` | no | -| tags | Tags | `map(string)` | `{}` | no | -| user\_data | The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see user\_data\_base64 instead. | `string` | `null` | no | -| user\_data\_base64 | Can be used instead of user\_data to pass base64-encoded binary data directly. Use this instead of user\_data whenever the value is not a valid UTF-8 string. For example, gzip-encoded user data must be base64-encoded and passed via this argument to avoid corruption. | `string` | `null` | no | -| vpc\_id | VPC ID | `string` | n/a | yes | +| [ami\_id](#input\_ami\_id) | AMI Identifier | `string` | `""` | no | +| [associate\_public\_ip\_address](#input\_associate\_public\_ip\_address) | Associate a public IP address with the instance | `bool` | `false` | no | +| [aws\_ami\_os\_id](#input\_aws\_ami\_os\_id) | AWS AMI Operating System Identificator | `string` | `"ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-*"` | no | +| [aws\_ami\_os\_owner](#input\_aws\_ami\_os\_owner) | AWS AMI Operating System Owner, eg: 099720109477 for Canonical | `string` | `"099720109477"` | no | +| [credit\_specification\_cpu](#input\_credit\_specification\_cpu) | Can be applied/modified to the EC2 at any time. The credit option for CPU usage. Can be 'standard' or 'unlimited'. By default T3 = unlimited & T2 'standard'. | `string` | `"unlimited"` | no | +| [cross\_account\_roles\_resource\_arn\_list](#input\_cross\_account\_roles\_resource\_arn\_list) | Resources arn list for cross org roles for EC2 profile IAM Role policy. | `list(string)` | `[]` | no | +| [disable\_api\_termination](#input\_disable\_api\_termination) | If true, enables EC2 Instance Termination Protection | `string` | `"false"` | no | +| [dns\_records\_internal\_hosted\_zone](#input\_dns\_records\_internal\_hosted\_zone) | A list of DNS private (internal hosted zone) records to create with the instance's IP | `list(any)` | `[]` | no | +| [dns\_records\_public\_hosted\_zone](#input\_dns\_records\_public\_hosted\_zone) | A list of DNS public (public hosted zone) records to create with the instance's IP | `list(any)` | `[]` | no | +| [ebs\_block\_device](#input\_ebs\_block\_device) | Additional EBS block devices to attach to the instance | `list(map(string))` | `[]` | no | +| [ebs\_optimized](#input\_ebs\_optimized) | Enable EBS Optimized | `string` | `"false"` | no | +| [ephemeral\_block\_device](#input\_ephemeral\_block\_device) | Customize Ephemeral (also known as Instance Store) volumes on the instance | `list(map(string))` | `[]` | no | +| [instance\_profile](#input\_instance\_profile) | The IAM Instance Profile to launch the instance with. Specified as the name of the Instance Profile. | `string` | `""` | no | +| [instance\_type](#input\_instance\_type) | EC2 Instance Type | `string` | `"t3.micro"` | no | +| [key\_pair\_name](#input\_key\_pair\_name) | Key Pair Name | `string` | n/a | yes | +| [monitoring](#input\_monitoring) | If true, the launched EC2 instance will have detailed monitoring enabled | `bool` | `false` | no | +| [name](#input\_name) | Name | `string` | n/a | yes | +| [policy\_arn](#input\_policy\_arn) | Attach AWS IAM managed policies to the IAM Role. | `list(string)` | `[]` | no | +| [prefix](#input\_prefix) | Prefix | `string` | `"default"` | no | +| [root\_block\_device](#input\_root\_block\_device) | Customize details about the root block device of the instance. See Block Devices below for details | `list(map(string))` | `[]` | no | +| [root\_device\_backup\_tag](#input\_root\_device\_backup\_tag) | EC2 Root Block Device backup tag | `string` | `"True"` | no | +| [security\_group\_rules](#input\_security\_group\_rules) | A list of security group rules | `list(any)` | `[]` | no | +| [subnet\_id](#input\_subnet\_id) | Subnet ID | `string` | n/a | yes | +| [tag\_approved\_ami\_value](#input\_tag\_approved\_ami\_value) | Set the specific tag ApprovedAMI ('true' \| 'false') that identifies aws-config compliant AMIs | `string` | `"false"` | no | +| [tags](#input\_tags) | Tags | `map(string)` | `{}` | no | +| [user\_data](#input\_user\_data) | The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see user\_data\_base64 instead. | `string` | `null` | no | +| [user\_data\_base64](#input\_user\_data\_base64) | Can be used instead of user\_data to pass base64-encoded binary data directly. Use this instead of user\_data whenever the value is not a valid UTF-8 string. For example, gzip-encoded user data must be base64-encoded and passed via this argument to avoid corruption. | `string` | `null` | no | +| [vpc\_id](#input\_vpc\_id) | VPC ID | `string` | n/a | yes | ## Outputs | Name | Description | |------|-------------| -| aws\_instance\_ami | The AMI of the Instance. | -| aws\_instance\_assume\_role\_name | The IAM instance profile of the EC2. | -| aws\_instance\_iam\_profile | The IAM instance profile of the EC2. | -| aws\_instance\_key\_name | The ssh key pair name of the Instance. | -| aws\_instance\_private\_ip | Contains the instance private IP address. | -| aws\_instance\_public\_ip | Contains the instance public IP address. | -| aws\_instance\_type | The type of the Instance. | -| aws\_instance\_volume\_tags | The root EBS volume tags of the instace. | -| dns\_record\_private | DNS | -| dns\_record\_public | n/a | -| instance | Compute | -| security\_group | n/a | - +| [aws\_instance\_ami](#output\_aws\_instance\_ami) | The AMI of the Instance. | +| [aws\_instance\_assume\_role\_name](#output\_aws\_instance\_assume\_role\_name) | The IAM instance profile of the EC2. | +| [aws\_instance\_iam\_profile](#output\_aws\_instance\_iam\_profile) | The IAM instance profile of the EC2. | +| [aws\_instance\_key\_name](#output\_aws\_instance\_key\_name) | The ssh key pair name of the Instance. | +| [aws\_instance\_private\_ip](#output\_aws\_instance\_private\_ip) | Contains the instance private IP address. | +| [aws\_instance\_public\_ip](#output\_aws\_instance\_public\_ip) | Contains the instance public IP address. | +| [aws\_instance\_type](#output\_aws\_instance\_type) | The type of the Instance. | +| [aws\_instance\_volume\_tags](#output\_aws\_instance\_volume\_tags) | The root EBS volume tags of the instace. | +| [dns\_record\_private](#output\_dns\_record\_private) | DNS | +| [dns\_record\_public](#output\_dns\_record\_public) | n/a | +| [instance](#output\_instance) | Compute | +| [security\_group](#output\_security\_group) | n/a | ## Examples diff --git a/tests/verify_output_test.go b/tests/verify_output_test.go index 395bb6e..a0482e2 100644 --- a/tests/verify_output_test.go +++ b/tests/verify_output_test.go @@ -16,8 +16,8 @@ func TestAwsEc2BasicLayoutCase1(t *testing.T) { expectedValue3 := "bb-infra-deployer" expectedValue4 := "basic-instance-profile-infra-ec2-test" expectedValue5 := "basic-instance-role-infra-ec2-test" - expectedValue6 := "[\n \"ec2-basic-layout.aws.binbash.com.ar\",\n]" - expectedValue7 := "[\n \"ec2-basic-layout.binbash.com.ar\",\n]" + expectedValue6 := "[ec2-basic-layout.aws.binbash.com.ar]" + expectedValue7 := "[ec2-basic-layout.binbash.com.ar]" terraformOptions := &terraform.Options { // The path to where our Terraform code is located @@ -106,8 +106,8 @@ func TestAwsEc2BasicLayoutCase3(t *testing.T) { expectedValue3 := "bb-infra-deployer" expectedValue4 := "basic-instance-profile-external" expectedValue5 := "" - expectedValue6 := "[\n \"ec2-basic-layout.aws.binbash.com.ar\",\n]" - expectedValue7 := "[\n \"ec2-basic-layout.binbash.com.ar\",\n]" + expectedValue6 := "[ec2-basic-layout.aws.binbash.com.ar]" + expectedValue7 := "[ec2-basic-layout.binbash.com.ar]" terraformOptions := &terraform.Options { // The path to where our Terraform code is located