├── .circleci └── config.yml ├── .gitignore ├── .terraform.lock.hcl ├── LICENSE ├── README.md ├── assets ├── background.png └── index.html ├── main.tf ├── outputs.tf ├── terraform.tf ├── terraform.tfvars └── variables.tf /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) HashiCorp, Inc. 2 | # SPDX-License-Identifier: MIT 3 | 4 | version: 2 5 | 6 | jobs: 7 | plan-apply: 8 | working_directory: /tmp/project 9 | docker: 10 | - image: docker.mirror.hashicorp.services/hashicorp/terraform:light 11 | steps: 12 | - checkout 13 | - run: 14 | name: terraform init & plan 15 | command: | 16 | terraform init -input=false 17 | terraform plan -out tfapply -var-file terraform.tfvars 18 | - persist_to_workspace: 19 | root: . 20 | paths: 21 | - . 22 | 23 | apply: 24 | docker: 25 | - image: docker.mirror.hashicorp.services/hashicorp/terraform:light 26 | steps: 27 | - attach_workspace: 28 | at: . 29 | - run: 30 | name: terraform 31 | command: | 32 | terraform apply -auto-approve tfapply 33 | - persist_to_workspace: 34 | root: . 35 | paths: 36 | - . 37 | 38 | plan-destroy: 39 | docker: 40 | - image: docker.mirror.hashicorp.services/hashicorp/terraform:light 41 | steps: 42 | - attach_workspace: 43 | at: . 44 | - run: 45 | name: terraform create destroy plan 46 | command: | 47 | terraform plan -destroy -out tfdestroy -var-file terraform.tfvars 48 | - persist_to_workspace: 49 | root: . 50 | paths: 51 | - . 52 | 53 | destroy: 54 | docker: 55 | - image: docker.mirror.hashicorp.services/hashicorp/terraform:light 56 | steps: 57 | - attach_workspace: 58 | at: . 59 | - run: 60 | name: terraform destroy 61 | command: | 62 | terraform apply -auto-approve tfdestroy 63 | workflows: 64 | version: 2 65 | plan_approve_apply: 66 | jobs: 67 | - plan-apply 68 | - hold-apply: 69 | type: approval 70 | requires: 71 | - plan-apply 72 | - apply: 73 | requires: 74 | - hold-apply 75 | - plan-destroy: 76 | requires: 77 | - apply 78 | - hold-destroy: 79 | type: approval 80 | requires: 81 | - plan-destroy 82 | - destroy: 83 | requires: 84 | - hold-destroy 85 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Local .terraform directories 2 | **/.terraform/* 3 | 4 | # .tfstate files 5 | *.tfstate 6 | *.tfstate.* 7 | 8 | # Crash log files 9 | crash.log 10 | 11 | # Ignore any .tfvars files that are generated automatically for each Terraform run. Most 12 | # .tfvars files are managed as part of configuration and so should be included in 13 | # version control. 14 | # 15 | # example.tfvars 16 | 17 | # Ignore override files as they are usually used to override resources locally and so 18 | # are not checked in 19 | override.tf 20 | override.tf.json 21 | *_override.tf 22 | *_override.tf.json 23 | 24 | # Include override files you do wish to add to version control using negated pattern 25 | # 26 | # !example_override.tf 27 | 28 | # Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan 29 | # example: *tfplan* 30 | -------------------------------------------------------------------------------- /.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.21.0" 6 | constraints = "~> 5.21.0" 7 | hashes = [ 8 | "h1:bCRZDV8QYPpl+zIU7karO77B4x2cvQ7UHKAGNvTFWQs=", 9 | "zh:1ba1411e4f8c047950db94c236f146d4590790320c68320b4e56082d8746a507", 10 | "zh:3185e4a34cfcad35dcf11439290a4bd0ad52d462eca2ab5d4940488a2db72833", 11 | "zh:3c6b901f874b4d9a85301a653d0bd507b052992bd84fc81100f4e5f73b1adab7", 12 | "zh:45d3fdbbc5804f295576b7155fdca527dedff17a014ed40c215af3bc60c329db", 13 | "zh:47b64b453d2c373062e47a54f3df33335dc29bce6ddbbf2da9e7be768c560abe", 14 | "zh:5cdf57ffd465288d9732d14ba13b377a8d389e0ba0ce3ac4773fd6fdfc09d6a1", 15 | "zh:81ec4c662581a2446c78da7b27d7e0d5c2e4d50925294789ec13661817f4b5a4", 16 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 17 | "zh:ac248464fd4ce1f020c05f27e3182532a7d1af4b8185a4b4be8b906b30b0ca5a", 18 | "zh:bbbedc6b6eaffcce0b31b397d607464f0c21c1b9406182163d504d3f392cc68d", 19 | "zh:c2afc111f9503829ed055e2ae91d873670c57bd16acc1a3246ac3957f6998d4e", 20 | "zh:cd3c8175b2152848113482da70e5b9c7cb4c951f2046fc0b832715300bd88b97", 21 | "zh:cf89b0c09d426d489f9477209d4084e64ad1b598036284fa688b41de626b58e6", 22 | "zh:d9d127637c3b9ff6e2d0a2c30f54bd48ab1de34f725a5df1a6a3d039b021e636", 23 | "zh:dccca1090e4054d6558218406385fb0421ab4ac3b75e121641973be481a81f01", 24 | ] 25 | } 26 | 27 | provider "registry.terraform.io/hashicorp/random" { 28 | version = "3.5.1" 29 | hashes = [ 30 | "h1:IL9mSatmwov+e0+++YX2V6uel+dV6bn+fC/cnGDK3Ck=", 31 | "zh:04e3fbd610cb52c1017d282531364b9c53ef72b6bc533acb2a90671957324a64", 32 | "zh:119197103301ebaf7efb91df8f0b6e0dd31e6ff943d231af35ee1831c599188d", 33 | "zh:4d2b219d09abf3b1bb4df93d399ed156cadd61f44ad3baf5cf2954df2fba0831", 34 | "zh:6130bdde527587bbe2dcaa7150363e96dbc5250ea20154176d82bc69df5d4ce3", 35 | "zh:6cc326cd4000f724d3086ee05587e7710f032f94fc9af35e96a386a1c6f2214f", 36 | "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", 37 | "zh:b6d88e1d28cf2dfa24e9fdcc3efc77adcdc1c3c3b5c7ce503a423efbdd6de57b", 38 | "zh:ba74c592622ecbcef9dc2a4d81ed321c4e44cddf7da799faa324da9bf52a22b2", 39 | "zh:c7c5cde98fe4ef1143bd1b3ec5dc04baf0d4cc3ca2c5c7d40d17c0e9b2076865", 40 | "zh:dac4bad52c940cd0dfc27893507c1e92393846b024c5a9db159a93c534a3da03", 41 | "zh:de8febe2a2acd9ac454b844a4106ed295ae9520ef54dc8ed2faf29f12716b602", 42 | "zh:eab0d0495e7e711cca367f7d4df6e322e6c562fc52151ec931176115b83ed014", 43 | ] 44 | } 45 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019 HashiCorp, Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # learn-terraform-circleci 2 | 3 | This is a companion repository for the Hashicorp [Learn content on CircleCI](https://developer.hashicorp.com/terraform/tutorials/automation/circle-ci) tutorial. 4 | -------------------------------------------------------------------------------- /assets/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp-education/learn-terraform-circleci/fafbaf5e1eac6801d7526127353c7f7be11636a1/assets/background.png -------------------------------------------------------------------------------- /assets/index.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 |
9 |