diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
new file mode 100644
index 0000000..d6afb8c
--- /dev/null
+++ b/.github/workflows/deploy.yml
@@ -0,0 +1,33 @@
+name: Deploy
+on:
+ push:
+ branches:
+ - main
+
+jobs:
+ deploy:
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write # To push a branch
+ pages: write # To push to a GitHub Pages site
+ id-token: write # To update the deployment status
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ - uses: taiki-e/install-action@v2
+ with:
+ tool: cargo-binstall@0.23.0,mdbook@0.4.34,mdbook-admonish@1.11.1
+ - name: Build Book
+ run: |
+ mdbook build
+ - name: Setup Pages
+ uses: actions/configure-pages@v2
+ - name: Upload artifact
+ uses: actions/upload-pages-artifact@v1
+ with:
+ # Upload entire repository
+ path: "book"
+ - name: Deploy to GitHub Pages
+ id: deployment
+ uses: actions/deploy-pages@v1
diff --git a/.gitignore b/.gitignore
index 9b8a46e..7585238 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,34 +1 @@
-# Local .terraform directories
-**/.terraform/*
-
-# .tfstate files
-*.tfstate
-*.tfstate.*
-
-# Crash log files
-crash.log
-crash.*.log
-
-# Exclude all .tfvars files, which are likely to contain sensitive data, such as
-# password, private keys, and other secrets. These should not be part of version
-# control as they are data points which are potentially sensitive and subject
-# to change depending on the environment.
-*.tfvars
-*.tfvars.json
-
-# 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
-
-# Include override files you do wish to add to version control using negated pattern
-# !example_override.tf
-
-# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
-# example: *tfplan*
-
-# Ignore CLI configuration files
-.terraformrc
-terraform.rc
+book
diff --git a/LICENSE b/LICENSE
index 7640889..b176c32 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,21 +1,418 @@
-MIT License
-
-Copyright (c) 2023 Matthew Burgess
-
-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.
+Attribution-ShareAlike 4.0 International
+
+=======================================================================
+
+Creative Commons Corporation ("Creative Commons") is not a law firm and
+does not provide legal services or legal advice. Distribution of
+Creative Commons public licenses does not create a lawyer-client or
+other relationship. Creative Commons makes its licenses and related
+information available on an "as-is" basis. Creative Commons gives no
+warranties regarding its licenses, any material licensed under their
+terms and conditions, or any related information. Creative Commons
+disclaims all liability for damages resulting from their use to the
+fullest extent possible.
+
+Using Creative Commons Public Licenses
+
+Creative Commons public licenses provide a standard set of terms and
+conditions that creators and other rights holders may use to share
+original works of authorship and other material subject to copyright
+and certain other rights specified in the public license below. The
+following considerations are for informational purposes only, are not
+exhaustive, and do not form part of our licenses.
+
+ Considerations for licensors: Our public licenses are
+ intended for use by those authorized to give the public
+ permission to use material in ways otherwise restricted by
+ copyright and certain other rights. Our licenses are
+ irrevocable. Licensors should read and understand the terms
+ and conditions of the license they choose before applying it.
+ Licensors should also secure all rights necessary before
+ applying our licenses so that the public can reuse the
+ material as expected. Licensors should clearly mark any
+ material not subject to the license. This includes other CC-
+ licensed material, or material used under an exception or
+ limitation to copyright. More considerations for licensors:
+ wiki.creativecommons.org/Considerations_for_licensors
+
+ Considerations for the public: By using one of our public
+ licenses, a licensor grants the public permission to use the
+ licensed material under specified terms and conditions. If
+ the licensor's permission is not necessary for any reason--for
+ example, because of any applicable exception or limitation to
+ copyright--then that use is not regulated by the license. Our
+ licenses grant only permissions under copyright and certain
+ other rights that a licensor has authority to grant. Use of
+ the licensed material may still be restricted for other
+ reasons, including because others have copyright or other
+ rights in the material. A licensor may make special requests,
+ such as asking that all changes be marked or described.
+ Although not required by our licenses, you are encouraged to
+ respect those requests where reasonable. More considerations
+ for the public:
+ wiki.creativecommons.org/Considerations_for_licensees
+
+=======================================================================
+
+Creative Commons Attribution-ShareAlike 4.0 International Public
+License
+
+By exercising the Licensed Rights (defined below), You accept and agree
+to be bound by the terms and conditions of this Creative Commons
+Attribution-ShareAlike 4.0 International Public License ("Public
+License"). To the extent this Public License may be interpreted as a
+contract, You are granted the Licensed Rights in consideration of Your
+acceptance of these terms and conditions, and the Licensor grants You
+such rights in consideration of benefits the Licensor receives from
+making the Licensed Material available under these terms and
+conditions.
+
+Section 1 -- Definitions.
+
+ a. Adapted Material means material subject to Copyright and Similar
+ Rights that is derived from or based upon the Licensed Material
+ and in which the Licensed Material is translated, altered,
+ arranged, transformed, or otherwise modified in a manner requiring
+ permission under the Copyright and Similar Rights held by the
+ Licensor. For purposes of this Public License, where the Licensed
+ Material is a musical work, performance, or sound recording,
+ Adapted Material is always produced where the Licensed Material is
+ synched in timed relation with a moving image.
+
+ b. Adapter's License means the license You apply to Your Copyright
+ and Similar Rights in Your contributions to Adapted Material in
+ accordance with the terms and conditions of this Public License.
+
+ c. BY-SA Compatible License means a license listed at
+ creativecommons.org/compatiblelicenses, approved by Creative
+ Commons as essentially the equivalent of this Public License.
+
+ d. Copyright and Similar Rights means copyright and/or similar rights
+ closely related to copyright including, without limitation,
+ performance, broadcast, sound recording, and Sui Generis Database
+ Rights, without regard to how the rights are labeled or
+ categorized. For purposes of this Public License, the rights
+ specified in Section 2(b)(1)-(2) are not Copyright and Similar
+ Rights.
+
+ e. Effective Technological Measures means those measures that, in the
+ absence of proper authority, may not be circumvented under laws
+ fulfilling obligations under Article 11 of the WIPO Copyright
+ Treaty adopted on December 20, 1996, and/or similar international
+ agreements.
+
+ f. Exceptions and Limitations means fair use, fair dealing, and/or
+ any other exception or limitation to Copyright and Similar Rights
+ that applies to Your use of the Licensed Material.
+
+ g. License Elements means the license attributes listed in the name
+ of a Creative Commons Public License. The License Elements of this
+ Public License are Attribution and ShareAlike.
+
+ h. Licensed Material means the artistic or literary work, database,
+ or other material to which the Licensor applied this Public
+ License.
+
+ i. Licensed Rights means the rights granted to You subject to the
+ terms and conditions of this Public License, which are limited to
+ all Copyright and Similar Rights that apply to Your use of the
+ Licensed Material and that the Licensor has authority to license.
+
+ j. Licensor means the individual(s) or entity(ies) granting rights
+ under this Public License.
+
+ k. Share means to provide material to the public by any means or
+ process that requires permission under the Licensed Rights, such
+ as reproduction, public display, public performance, distribution,
+ dissemination, communication, or importation, and to make material
+ available to the public including in ways that members of the
+ public may access the material from a place and at a time
+ individually chosen by them.
+
+ l. Sui Generis Database Rights means rights other than copyright
+ resulting from Directive 96/9/EC of the European Parliament and of
+ the Council of 11 March 1996 on the legal protection of databases,
+ as amended and/or succeeded, as well as other essentially
+ equivalent rights anywhere in the world.
+
+ m. You means the individual or entity exercising the Licensed Rights
+ under this Public License. Your has a corresponding meaning.
+
+Section 2 -- Scope.
+
+ a. License grant.
+
+ 1. Subject to the terms and conditions of this Public License,
+ the Licensor hereby grants You a worldwide, royalty-free,
+ non-sublicensable, non-exclusive, irrevocable license to
+ exercise the Licensed Rights in the Licensed Material to:
+
+ a. reproduce and Share the Licensed Material, in whole or
+ in part; and
+
+ b. produce, reproduce, and Share Adapted Material.
+
+ 2. Exceptions and Limitations. For the avoidance of doubt, where
+ Exceptions and Limitations apply to Your use, this Public
+ License does not apply, and You do not need to comply with
+ its terms and conditions.
+
+ 3. Term. The term of this Public License is specified in Section
+ 6(a).
+
+ 4. Media and formats; technical modifications allowed. The
+ Licensor authorizes You to exercise the Licensed Rights in
+ all media and formats whether now known or hereafter created,
+ and to make technical modifications necessary to do so. The
+ Licensor waives and/or agrees not to assert any right or
+ authority to forbid You from making technical modifications
+ necessary to exercise the Licensed Rights, including
+ technical modifications necessary to circumvent Effective
+ Technological Measures. For purposes of this Public License,
+ simply making modifications authorized by this Section 2(a)
+ (4) never produces Adapted Material.
+
+ 5. Downstream recipients.
+
+ a. Offer from the Licensor -- Licensed Material. Every
+ recipient of the Licensed Material automatically
+ receives an offer from the Licensor to exercise the
+ Licensed Rights under the terms and conditions of this
+ Public License.
+
+ b. Additional offer from the Licensor -- Adapted Material.
+ Every recipient of Adapted Material from You
+ automatically receives an offer from the Licensor to
+ exercise the Licensed Rights in the Adapted Material
+ under the conditions of the Adapter's License You apply.
+
+ c. No downstream restrictions. You may not offer or impose
+ any additional or different terms or conditions on, or
+ apply any Effective Technological Measures to, the
+ Licensed Material if doing so restricts exercise of the
+ Licensed Rights by any recipient of the Licensed
+ Material.
+
+ 6. No endorsement. Nothing in this Public License constitutes or
+ may be construed as permission to assert or imply that You
+ are, or that Your use of the Licensed Material is, connected
+ with, or sponsored, endorsed, or granted official status by,
+ the Licensor or others designated to receive attribution as
+ provided in Section 3(a)(1)(A)(i).
+
+ b. Other rights.
+
+ 1. Moral rights, such as the right of integrity, are not
+ licensed under this Public License, nor are publicity,
+ privacy, and/or other similar personality rights; however, to
+ the extent possible, the Licensor waives and/or agrees not to
+ assert any such rights held by the Licensor to the limited
+ extent necessary to allow You to exercise the Licensed
+ Rights, but not otherwise.
+
+ 2. Patent and trademark rights are not licensed under this
+ Public License.
+
+ 3. To the extent possible, the Licensor waives any right to
+ collect royalties from You for the exercise of the Licensed
+ Rights, whether directly or through a collecting society
+ under any voluntary or waivable statutory or compulsory
+ licensing scheme. In all other cases the Licensor expressly
+ reserves any right to collect such royalties.
+
+Section 3 -- License Conditions.
+
+Your exercise of the Licensed Rights is expressly made subject to the
+following conditions.
+
+ a. Attribution.
+
+ 1. If You Share the Licensed Material (including in modified
+ form), You must:
+
+ a. retain the following if it is supplied by the Licensor
+ with the Licensed Material:
+
+ i. identification of the creator(s) of the Licensed
+ Material and any others designated to receive
+ attribution, in any reasonable manner requested by
+ the Licensor (including by pseudonym if
+ designated);
+
+ ii. a copyright notice;
+
+ iii. a notice that refers to this Public License;
+
+ iv. a notice that refers to the disclaimer of
+ warranties;
+
+ v. a URI or hyperlink to the Licensed Material to the
+ extent reasonably practicable;
+
+ b. indicate if You modified the Licensed Material and
+ retain an indication of any previous modifications; and
+
+ c. indicate the Licensed Material is licensed under this
+ Public License, and include the text of, or the URI or
+ hyperlink to, this Public License.
+
+ 2. You may satisfy the conditions in Section 3(a)(1) in any
+ reasonable manner based on the medium, means, and context in
+ which You Share the Licensed Material. For example, it may be
+ reasonable to satisfy the conditions by providing a URI or
+ hyperlink to a resource that includes the required
+ information.
+
+ 3. If requested by the Licensor, You must remove any of the
+ information required by Section 3(a)(1)(A) to the extent
+ reasonably practicable.
+
+ b. ShareAlike.
+
+ In addition to the conditions in Section 3(a), if You Share
+ Adapted Material You produce, the following conditions also apply.
+
+ 1. The Adapter's License You apply must be a Creative Commons
+ license with the same License Elements, this version or
+ later, or a BY-SA Compatible License.
+
+ 2. You must include the text of, or the URI or hyperlink to, the
+ Adapter's License You apply. You may satisfy this condition
+ in any reasonable manner based on the medium, means, and
+ context in which You Share Adapted Material.
+
+ 3. You may not offer or impose any additional or different terms
+ or conditions on, or apply any Effective Technological
+ Measures to, Adapted Material that restrict exercise of the
+ rights granted under the Adapter's License You apply.
+
+Section 4 -- Sui Generis Database Rights.
+
+Where the Licensed Rights include Sui Generis Database Rights that
+apply to Your use of the Licensed Material:
+
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
+ to extract, reuse, reproduce, and Share all or a substantial
+ portion of the contents of the database;
+
+ b. if You include all or a substantial portion of the database
+ contents in a database in which You have Sui Generis Database
+ Rights, then the database in which You have Sui Generis Database
+ Rights (but not its individual contents) is Adapted Material,
+ including for purposes of Section 3(b); and
+
+ c. You must comply with the conditions in Section 3(a) if You Share
+ all or a substantial portion of the contents of the database.
+
+For the avoidance of doubt, this Section 4 supplements and does not
+replace Your obligations under this Public License where the Licensed
+Rights include other Copyright and Similar Rights.
+
+Section 5 -- Disclaimer of Warranties and Limitation of Liability.
+
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
+ EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
+ AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
+ ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
+ IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
+ WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
+ ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
+ KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
+ ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
+
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
+ TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
+ NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
+ INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
+ COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
+ USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
+ ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
+ DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
+ IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
+
+ c. The disclaimer of warranties and limitation of liability provided
+ above shall be interpreted in a manner that, to the extent
+ possible, most closely approximates an absolute disclaimer and
+ waiver of all liability.
+
+Section 6 -- Term and Termination.
+
+ a. This Public License applies for the term of the Copyright and
+ Similar Rights licensed here. However, if You fail to comply with
+ this Public License, then Your rights under this Public License
+ terminate automatically.
+
+ b. Where Your right to use the Licensed Material has terminated under
+ Section 6(a), it reinstates:
+
+ 1. automatically as of the date the violation is cured, provided
+ it is cured within 30 days of Your discovery of the
+ violation; or
+
+ 2. upon express reinstatement by the Licensor.
+
+ For the avoidance of doubt, this Section 6(b) does not affect any
+ right the Licensor may have to seek remedies for Your violations
+ of this Public License.
+
+ c. For the avoidance of doubt, the Licensor may also offer the
+ Licensed Material under separate terms or conditions or stop
+ distributing the Licensed Material at any time; however, doing so
+ will not terminate this Public License.
+
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
+ License.
+
+Section 7 -- Other Terms and Conditions.
+
+ a. The Licensor shall not be bound by any additional or different
+ terms or conditions communicated by You unless expressly agreed.
+
+ b. Any arrangements, understandings, or agreements regarding the
+ Licensed Material not stated herein are separate from and
+ independent of the terms and conditions of this Public License.
+
+Section 8 -- Interpretation.
+
+ a. For the avoidance of doubt, this Public License does not, and
+ shall not be interpreted to, reduce, limit, restrict, or impose
+ conditions on any use of the Licensed Material that could lawfully
+ be made without permission under this Public License.
+
+ b. To the extent possible, if any provision of this Public License is
+ deemed unenforceable, it shall be automatically reformed to the
+ minimum extent necessary to make it enforceable. If the provision
+ cannot be reformed, it shall be severed from this Public License
+ without affecting the enforceability of the remaining terms and
+ conditions.
+
+ c. No term or condition of this Public License will be waived and no
+ failure to comply consented to unless expressly agreed to by the
+ Licensor.
+
+ d. Nothing in this Public License constitutes or may be interpreted
+ as a limitation upon, or waiver of, any privileges and immunities
+ that apply to the Licensor or You, including from the legal
+ processes of any jurisdiction or authority.
+
+=======================================================================
+
+Creative Commons is not a party to its public
+licenses. Notwithstanding, Creative Commons may elect to apply one of
+its public licenses to material it publishes and in those instances
+will be considered the “Licensor.” The text of the Creative Commons
+public licenses is dedicated to the public domain under the CC0 Public
+Domain Dedication. Except for the limited purpose of indicating that
+material is shared under a Creative Commons public license or as
+otherwise permitted by the Creative Commons policies published at
+creativecommons.org/policies, Creative Commons does not authorize the
+use of the trademark "Creative Commons" or any other trademark or logo
+of Creative Commons without its prior written consent including,
+without limitation, in connection with any unauthorized modifications
+to any of its public licenses or any other arrangements,
+understandings, or agreements concerning use of licensed material. For
+the avoidance of doubt, this paragraph does not form part of the
+public licenses.
+
+Creative Commons may be contacted at creativecommons.org.
diff --git a/book.toml b/book.toml
new file mode 100644
index 0000000..23e1491
--- /dev/null
+++ b/book.toml
@@ -0,0 +1,17 @@
+[book]
+authors = ["Matt Burgess"]
+language = "en"
+multilingual = false
+src = "src"
+title = "Terraform Cloud Path to Production Guide"
+
+[preprocessor]
+
+[preprocessor.admonish]
+command = "mdbook-admonish"
+assets_version = "2.0.2" # do not edit: managed by `mdbook-admonish install`
+
+[output]
+
+[output.html]
+additional-css = ["./mdbook-admonish.css"]
diff --git a/mdbook-admonish.css b/mdbook-admonish.css
new file mode 100644
index 0000000..c3e9869
--- /dev/null
+++ b/mdbook-admonish.css
@@ -0,0 +1,353 @@
+@charset "UTF-8";
+:root {
+ --md-admonition-icon--note:
+ url("data:image/svg+xml;charset=utf-8,");
+ --md-admonition-icon--abstract:
+ url("data:image/svg+xml;charset=utf-8,");
+ --md-admonition-icon--info:
+ url("data:image/svg+xml;charset=utf-8,");
+ --md-admonition-icon--tip:
+ url("data:image/svg+xml;charset=utf-8,");
+ --md-admonition-icon--success:
+ url("data:image/svg+xml;charset=utf-8,");
+ --md-admonition-icon--question:
+ url("data:image/svg+xml;charset=utf-8,");
+ --md-admonition-icon--warning:
+ url("data:image/svg+xml;charset=utf-8,");
+ --md-admonition-icon--failure:
+ url("data:image/svg+xml;charset=utf-8,");
+ --md-admonition-icon--danger:
+ url("data:image/svg+xml;charset=utf-8,");
+ --md-admonition-icon--bug:
+ url("data:image/svg+xml;charset=utf-8,");
+ --md-admonition-icon--example:
+ url("data:image/svg+xml;charset=utf-8,");
+ --md-admonition-icon--quote:
+ url("data:image/svg+xml;charset=utf-8,");
+ --md-details-icon:
+ url("data:image/svg+xml;charset=utf-8,");
+}
+
+:is(.admonition) {
+ display: flow-root;
+ margin: 1.5625em 0;
+ padding: 0 1.2rem;
+ color: var(--fg);
+ page-break-inside: avoid;
+ background-color: var(--bg);
+ border: 0 solid black;
+ border-inline-start-width: 0.4rem;
+ border-radius: 0.2rem;
+ box-shadow: 0 0.2rem 1rem rgba(0, 0, 0, 0.05), 0 0 0.1rem rgba(0, 0, 0, 0.1);
+}
+@media print {
+ :is(.admonition) {
+ box-shadow: none;
+ }
+}
+:is(.admonition) > * {
+ box-sizing: border-box;
+}
+:is(.admonition) :is(.admonition) {
+ margin-top: 1em;
+ margin-bottom: 1em;
+}
+:is(.admonition) > .tabbed-set:only-child {
+ margin-top: 0;
+}
+html :is(.admonition) > :last-child {
+ margin-bottom: 1.2rem;
+}
+
+a.admonition-anchor-link {
+ display: none;
+ position: absolute;
+ left: -1.2rem;
+ padding-right: 1rem;
+}
+a.admonition-anchor-link:link, a.admonition-anchor-link:visited {
+ color: var(--fg);
+}
+a.admonition-anchor-link:link:hover, a.admonition-anchor-link:visited:hover {
+ text-decoration: none;
+}
+a.admonition-anchor-link::before {
+ content: "§";
+}
+
+:is(.admonition-title, summary.admonition-title) {
+ position: relative;
+ min-height: 4rem;
+ margin-block: 0;
+ margin-inline: -1.6rem -1.2rem;
+ padding-block: 0.8rem;
+ padding-inline: 4.4rem 1.2rem;
+ font-weight: 700;
+ background-color: rgba(68, 138, 255, 0.1);
+ display: flex;
+}
+:is(.admonition-title, summary.admonition-title) p {
+ margin: 0;
+}
+html :is(.admonition-title, summary.admonition-title):last-child {
+ margin-bottom: 0;
+}
+:is(.admonition-title, summary.admonition-title)::before {
+ position: absolute;
+ top: 0.625em;
+ inset-inline-start: 1.6rem;
+ width: 2rem;
+ height: 2rem;
+ background-color: #448aff;
+ mask-image: url('data:image/svg+xml;charset=utf-8,');
+ -webkit-mask-image: url('data:image/svg+xml;charset=utf-8,');
+ mask-repeat: no-repeat;
+ -webkit-mask-repeat: no-repeat;
+ mask-size: contain;
+ -webkit-mask-size: contain;
+ content: "";
+}
+:is(.admonition-title, summary.admonition-title):hover a.admonition-anchor-link {
+ display: initial;
+}
+
+details.admonition > summary.admonition-title::after {
+ position: absolute;
+ top: 0.625em;
+ inset-inline-end: 1.6rem;
+ height: 2rem;
+ width: 2rem;
+ background-color: currentcolor;
+ mask-image: var(--md-details-icon);
+ -webkit-mask-image: var(--md-details-icon);
+ mask-repeat: no-repeat;
+ -webkit-mask-repeat: no-repeat;
+ mask-size: contain;
+ -webkit-mask-size: contain;
+ content: "";
+ transform: rotate(0deg);
+ transition: transform 0.25s;
+}
+details[open].admonition > summary.admonition-title::after {
+ transform: rotate(90deg);
+}
+
+:is(.admonition):is(.note) {
+ border-color: #448aff;
+}
+
+:is(.note) > :is(.admonition-title, summary.admonition-title) {
+ background-color: rgba(68, 138, 255, 0.1);
+}
+:is(.note) > :is(.admonition-title, summary.admonition-title)::before {
+ background-color: #448aff;
+ mask-image: var(--md-admonition-icon--note);
+ -webkit-mask-image: var(--md-admonition-icon--note);
+ mask-repeat: no-repeat;
+ -webkit-mask-repeat: no-repeat;
+ mask-size: contain;
+ -webkit-mask-repeat: no-repeat;
+}
+
+:is(.admonition):is(.abstract, .summary, .tldr) {
+ border-color: #00b0ff;
+}
+
+:is(.abstract, .summary, .tldr) > :is(.admonition-title, summary.admonition-title) {
+ background-color: rgba(0, 176, 255, 0.1);
+}
+:is(.abstract, .summary, .tldr) > :is(.admonition-title, summary.admonition-title)::before {
+ background-color: #00b0ff;
+ mask-image: var(--md-admonition-icon--abstract);
+ -webkit-mask-image: var(--md-admonition-icon--abstract);
+ mask-repeat: no-repeat;
+ -webkit-mask-repeat: no-repeat;
+ mask-size: contain;
+ -webkit-mask-repeat: no-repeat;
+}
+
+:is(.admonition):is(.info, .todo) {
+ border-color: #00b8d4;
+}
+
+:is(.info, .todo) > :is(.admonition-title, summary.admonition-title) {
+ background-color: rgba(0, 184, 212, 0.1);
+}
+:is(.info, .todo) > :is(.admonition-title, summary.admonition-title)::before {
+ background-color: #00b8d4;
+ mask-image: var(--md-admonition-icon--info);
+ -webkit-mask-image: var(--md-admonition-icon--info);
+ mask-repeat: no-repeat;
+ -webkit-mask-repeat: no-repeat;
+ mask-size: contain;
+ -webkit-mask-repeat: no-repeat;
+}
+
+:is(.admonition):is(.tip, .hint, .important) {
+ border-color: #00bfa5;
+}
+
+:is(.tip, .hint, .important) > :is(.admonition-title, summary.admonition-title) {
+ background-color: rgba(0, 191, 165, 0.1);
+}
+:is(.tip, .hint, .important) > :is(.admonition-title, summary.admonition-title)::before {
+ background-color: #00bfa5;
+ mask-image: var(--md-admonition-icon--tip);
+ -webkit-mask-image: var(--md-admonition-icon--tip);
+ mask-repeat: no-repeat;
+ -webkit-mask-repeat: no-repeat;
+ mask-size: contain;
+ -webkit-mask-repeat: no-repeat;
+}
+
+:is(.admonition):is(.success, .check, .done) {
+ border-color: #00c853;
+}
+
+:is(.success, .check, .done) > :is(.admonition-title, summary.admonition-title) {
+ background-color: rgba(0, 200, 83, 0.1);
+}
+:is(.success, .check, .done) > :is(.admonition-title, summary.admonition-title)::before {
+ background-color: #00c853;
+ mask-image: var(--md-admonition-icon--success);
+ -webkit-mask-image: var(--md-admonition-icon--success);
+ mask-repeat: no-repeat;
+ -webkit-mask-repeat: no-repeat;
+ mask-size: contain;
+ -webkit-mask-repeat: no-repeat;
+}
+
+:is(.admonition):is(.question, .help, .faq) {
+ border-color: #64dd17;
+}
+
+:is(.question, .help, .faq) > :is(.admonition-title, summary.admonition-title) {
+ background-color: rgba(100, 221, 23, 0.1);
+}
+:is(.question, .help, .faq) > :is(.admonition-title, summary.admonition-title)::before {
+ background-color: #64dd17;
+ mask-image: var(--md-admonition-icon--question);
+ -webkit-mask-image: var(--md-admonition-icon--question);
+ mask-repeat: no-repeat;
+ -webkit-mask-repeat: no-repeat;
+ mask-size: contain;
+ -webkit-mask-repeat: no-repeat;
+}
+
+:is(.admonition):is(.warning, .caution, .attention) {
+ border-color: #ff9100;
+}
+
+:is(.warning, .caution, .attention) > :is(.admonition-title, summary.admonition-title) {
+ background-color: rgba(255, 145, 0, 0.1);
+}
+:is(.warning, .caution, .attention) > :is(.admonition-title, summary.admonition-title)::before {
+ background-color: #ff9100;
+ mask-image: var(--md-admonition-icon--warning);
+ -webkit-mask-image: var(--md-admonition-icon--warning);
+ mask-repeat: no-repeat;
+ -webkit-mask-repeat: no-repeat;
+ mask-size: contain;
+ -webkit-mask-repeat: no-repeat;
+}
+
+:is(.admonition):is(.failure, .fail, .missing) {
+ border-color: #ff5252;
+}
+
+:is(.failure, .fail, .missing) > :is(.admonition-title, summary.admonition-title) {
+ background-color: rgba(255, 82, 82, 0.1);
+}
+:is(.failure, .fail, .missing) > :is(.admonition-title, summary.admonition-title)::before {
+ background-color: #ff5252;
+ mask-image: var(--md-admonition-icon--failure);
+ -webkit-mask-image: var(--md-admonition-icon--failure);
+ mask-repeat: no-repeat;
+ -webkit-mask-repeat: no-repeat;
+ mask-size: contain;
+ -webkit-mask-repeat: no-repeat;
+}
+
+:is(.admonition):is(.danger, .error) {
+ border-color: #ff1744;
+}
+
+:is(.danger, .error) > :is(.admonition-title, summary.admonition-title) {
+ background-color: rgba(255, 23, 68, 0.1);
+}
+:is(.danger, .error) > :is(.admonition-title, summary.admonition-title)::before {
+ background-color: #ff1744;
+ mask-image: var(--md-admonition-icon--danger);
+ -webkit-mask-image: var(--md-admonition-icon--danger);
+ mask-repeat: no-repeat;
+ -webkit-mask-repeat: no-repeat;
+ mask-size: contain;
+ -webkit-mask-repeat: no-repeat;
+}
+
+:is(.admonition):is(.bug) {
+ border-color: #f50057;
+}
+
+:is(.bug) > :is(.admonition-title, summary.admonition-title) {
+ background-color: rgba(245, 0, 87, 0.1);
+}
+:is(.bug) > :is(.admonition-title, summary.admonition-title)::before {
+ background-color: #f50057;
+ mask-image: var(--md-admonition-icon--bug);
+ -webkit-mask-image: var(--md-admonition-icon--bug);
+ mask-repeat: no-repeat;
+ -webkit-mask-repeat: no-repeat;
+ mask-size: contain;
+ -webkit-mask-repeat: no-repeat;
+}
+
+:is(.admonition):is(.example) {
+ border-color: #7c4dff;
+}
+
+:is(.example) > :is(.admonition-title, summary.admonition-title) {
+ background-color: rgba(124, 77, 255, 0.1);
+}
+:is(.example) > :is(.admonition-title, summary.admonition-title)::before {
+ background-color: #7c4dff;
+ mask-image: var(--md-admonition-icon--example);
+ -webkit-mask-image: var(--md-admonition-icon--example);
+ mask-repeat: no-repeat;
+ -webkit-mask-repeat: no-repeat;
+ mask-size: contain;
+ -webkit-mask-repeat: no-repeat;
+}
+
+:is(.admonition):is(.quote, .cite) {
+ border-color: #9e9e9e;
+}
+
+:is(.quote, .cite) > :is(.admonition-title, summary.admonition-title) {
+ background-color: rgba(158, 158, 158, 0.1);
+}
+:is(.quote, .cite) > :is(.admonition-title, summary.admonition-title)::before {
+ background-color: #9e9e9e;
+ mask-image: var(--md-admonition-icon--quote);
+ -webkit-mask-image: var(--md-admonition-icon--quote);
+ mask-repeat: no-repeat;
+ -webkit-mask-repeat: no-repeat;
+ mask-size: contain;
+ -webkit-mask-repeat: no-repeat;
+}
+
+.navy :is(.admonition) {
+ background-color: var(--sidebar-bg);
+}
+
+.ayu :is(.admonition), .coal :is(.admonition) {
+ background-color: var(--theme-hover);
+}
+
+.rust :is(.admonition) {
+ background-color: var(--sidebar-bg);
+ color: var(--sidebar-fg);
+}
+.rust .admonition-anchor-link:link, .rust .admonition-anchor-link:visited {
+ color: var(--sidebar-fg);
+}
diff --git a/src/SUMMARY.md b/src/SUMMARY.md
new file mode 100644
index 0000000..af3cc93
--- /dev/null
+++ b/src/SUMMARY.md
@@ -0,0 +1,9 @@
+# Summary
+
+- [Introduction](./introduction.md)
+- [Terraform Cloud Setup](tfcloud-setup/README.md)
+ - [Pre-Requisites](tfcloud-setup/pre-requisites.md)
+ - [Configure Terraform for Local Runs](tfcloud-setup/terraform-local.md)
+ - [Create Terraform Cloud Resources](tfcloud-setup/tfcloud-resources.md)
+ - [Migrate Local State to Terraform Cloud](tfcloud-setup/tfcloud-state-migration.md)
+ - [VCS Workflow Integration](tfcloud-setup/vcs-workflow-integration.md)
diff --git a/src/introduction.md b/src/introduction.md
new file mode 100644
index 0000000..e30756c
--- /dev/null
+++ b/src/introduction.md
@@ -0,0 +1,11 @@
+# Introduction
+
+Terraform Cloud is a Hashicorp product that can be used to automate making changes to your cloud infrastrucure. This guide will help you configure and use Terraform Cloud to implement a "Path to Production" pipeline for such changes. The pipeline is designed to avoid any manual steps and ensure changes are well tested, and are safe to make in a production environment.
+
+## Contributing
+
+This guide is free and open source. You can find the source on [GitHub](https://github.com/mattburgess/tfcloud-guide). If you spot any mistakes or have any feature requests these can be posted on the [GitHub issue tracker](https://github.com/mattburgess/tfcloud-guide/issues).
+
+## License
+
+This guide is released under the [Creative Commons Attribution-ShareAlike 4.0 International license](https://creativecommons.org/licenses/by-sa/4.0/legalcode)
diff --git a/src/tfcloud-setup/README.md b/src/tfcloud-setup/README.md
new file mode 100644
index 0000000..9bd1770
--- /dev/null
+++ b/src/tfcloud-setup/README.md
@@ -0,0 +1,8 @@
+# Terraform Cloud Setup
+
+This chapter will help you to configure the following Terraform Cloud resources, and will do so using Terraform itself. By the end of this chapter you will have:
+
+* A Terraform Cloud Organization
+* A Terraform Cloud Project
+* A Terraform Cloud Workspace
+* Integration between the Workspace and a GitHub repository such that commits to that repository will trigger a `terraform plan` in Terraform Cloud
diff --git a/src/tfcloud-setup/locals.tf b/src/tfcloud-setup/locals.tf
new file mode 100644
index 0000000..0852781
--- /dev/null
+++ b/src/tfcloud-setup/locals.tf
@@ -0,0 +1,5 @@
+locals {
+ tfcloud_org_name = "your_tfcloud_org_name"
+ tfcloud_org_admin_email = "your_email_address"
+ github_org_name = "your_github_org_name"
+}
diff --git a/src/tfcloud-setup/organization.tf b/src/tfcloud-setup/organization.tf
new file mode 100644
index 0000000..4918a92
--- /dev/null
+++ b/src/tfcloud-setup/organization.tf
@@ -0,0 +1,17 @@
+resource "tfe_organization" "example" {
+ name = local.tfcloud_org_name
+ email = local.tfcloud_org_admin_email
+
+ lifecycle {
+ prevent_destroy = true
+ }
+}
+
+resource "tfe_oauth_client" "example_github" {
+ name = "tfe-tfcloud-mgmt-github-oauth-client"
+ organization = tfe_organization.example.name
+ api_url = "https://api.github.com"
+ http_url = "https://github.com"
+ oauth_token = var.github_ro_token
+ service_provider = "github"
+}
diff --git a/src/tfcloud-setup/pre-requisites.md b/src/tfcloud-setup/pre-requisites.md
new file mode 100644
index 0000000..be69c7e
--- /dev/null
+++ b/src/tfcloud-setup/pre-requisites.md
@@ -0,0 +1,93 @@
+# Pre-Requisites
+
+A number of accounts, credentials and command line utilities are required in order to follow this guide.
+
+## Accounts
+
+1. An account on [HashiCorp Cloud Platform (HCP)](https://portal.cloud.hashicorp.com/sign-up)
+
+1. An account on Terraform Cloud; visit [Terraform Cloud](https://app.terraform.io) and click `Continue with HCP Account`
+
+1. An account on [GitHub](https://github.com/signup)
+
+## Command Line Utilities
+
+1. The `terraform` CLI. Follow Hashicorp's [Installation instructions](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli) for your OS of choice. Although you'll be using Terraform Cloud to ultimately deploy your infrastructure, the local CLI is used to initially bootstrap things and can be further used to execute plans and applies in Terraform Cloud
+
+## Terraform Code Working Directory
+
+We'll need a directory to work from which will contain our initial Terraform code that will create the Terraform Cloud resources and GitHub repository. The rest of the instructions in this chapter assume you're in the top level of that directory:
+
+```sh
+mkdir tfcloud-mgmt-scratch
+cd tfcloud-mgmt-scratch
+```
+
+## Terraform Cloud API Key
+
+In order for the `terraform` CLI - both your local binary and that on the Terraform Cloud servers - to interact with Terraform Cloud, you need to generate an authorization token, otherwise known as an API key.
+
+Create the API key:
+
+```sh
+terraform login
+```
+
+```admonish note
+This is only required the first time you need to create an API key. The `login` command will create a credentials file (`credentials.tfrc.json`) which will be used by your local `terraform` CLI.
+```
+
+Create a file called `credentials.auto.tfvars` using the following command:
+
+```sh
+tfe_token=$(jq -r '.credentials."app.terraform.io".token' ~/.terraform.d/credentials.tfrc.json)
+echo "tfe_token = \"${tfe_token}\"" > credentials.auto.tfvars
+```
+
+```admonish note
+The default `.gitignore` file that was added to the repo during initial creation will prevent this `credentials.auto.tfvars` file from being committed; this is exactly what we want as it contains security-critical information that you absolutely **do not** want made public on GitHub.
+```
+
+## GitHub Personal Access Token for Pipelines
+
+Similar to the Terraform Cloud API key created above, because Terraform will be interacting with GitHub to detect code changes then it needs an authorization token.
+
+GitHub's [documentation](https://docs.github.com/en/enterprise-server@3.6/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) shows how to create a PAT.
+
+Applying the principle of least privilege, the PAT token only needs read access to repositories. This enables Terraform Cloud to detect commits pushed to repositories and subsequently run plans and applies based on those changes. To grant this access select `Repository access -> All repositories` then under `Permissions -> Repository permissions` select `Contents -> Read-only`. Terraform Cloud also needs to be able to create webhooks. To grant this access
+select `Permissions -> Repository permissions -> Webhooks -> Read and Write`
+
+Set the appropriate credentials variable:
+
+```sh
+echo 'github_ro_token = "github_pat_*****..."' >> credentials.auto.tfvars
+```
+
+```admonish tip
+The GitHub PAT above has access to **all** repositories; this is done on the assumption that there will be several repositories containing Terraform code. It also reduces friction if a team creates new repositories that contain Terraform code as a new PAT won't need to be generated to grant access to them. Your security posture may be different though, so you may need to create a PAT with access to only specific repositories.
+```
+
+## GitHub Personal Access Token for Repository Management
+
+The [Terraform Provider for GitHub](https://github.com/integrations/terraform-provider-github) is used to enable Terraform to create GitHub repositories and manage their settings. Because of these administrative type functions, it requires a PAT with much higher privilege than the PAT created above.
+
+To grant this access select `Repository access -> All repositories` then under `Permissions -> Repository permissions` select `Administration -> Read and write`. The provider also needs write access to the contents of repositories in order to manage certain settings. To grant this access
+select `Permissions -> Repository permissions -> Contents -> Read and write`
+
+Set the appropriate credentials variable:
+
+```sh
+echo 'github_admin_token = "github_pat_*****..."' >> credentials.auto.tfvars
+```
+
+```admonish warning
+The GitHub PAT above has **very** high privilges across **all** repositories. As such, it is crucial that this PAT isn't leaked or re-used for other purposes.
+```
+
+## Terraform Cloud and GitHub Related Settings
+
+Copy and paste the following into a new file, `locals.tf`, and adjust the values to match your desired Terraform Cloud and GitHub organization names:
+
+```hcl
+{{#include locals.tf}}
+```
diff --git a/src/tfcloud-setup/terraform-local.md b/src/tfcloud-setup/terraform-local.md
new file mode 100644
index 0000000..8061b8c
--- /dev/null
+++ b/src/tfcloud-setup/terraform-local.md
@@ -0,0 +1,54 @@
+# Configure Terraform for Local Runs
+
+At this early stage, all we want to do is ensure that `terraform`, when run locally, can initialize itself and run successfully but not manage any resources.
+
+Copy and paste the following Terraform code into a new file, `terraform.tf`, which will configure the [Terraform Enterprise provider](https://github.com/hashicorp/terraform-provider-tfe). Terraform will use local state files to keep track of any resources that it is managing.
+
+```hcl
+{{#include terraform.tf}}
+```
+
+Copy and paste the following Terraform code into a new file, `variables.tf`, which declares the input variables we set up earlier in `credentials.auto.tfvars`
+
+```hcl
+{{#include variables.tf}}
+```
+
+Initialize Terraform:
+
+```sh
+$ terraform init
+
+Initializing the backend...
+
+Initializing provider plugins...
+
+- Finding hashicorp/tfe versions matching "~> 0.48.0"...
+- Installing hashicorp/tfe v0.48.0...
+- Installed hashicorp/tfe v0.48.0 (signed by HashiCorp)
+
+Terraform has created a lock file .terraform.lock.hcl to record the provider
+selections it made above. Include this file in your version control repository
+so that Terraform can guarantee to make the same selections by default when
+you run "terraform init" in the future.
+
+Terraform has been successfully initialized!
+
+You may now begin working with Terraform. Try running "terraform plan" to see
+any changes that are required for your infrastructure. All Terraform commands
+should now work.
+
+If you ever set or change modules or backend configuration for Terraform,
+rerun this command to reinitialize your working directory. If you forget, other
+commands will detect it and remind you to do so if necessary.
+```
+
+At this point, a `terraform plan` should succeed but show no resources need to change, somewhat obviously due to us not having asked it to manage any just yet:
+
+```sh
+$ terraform plan
+
+No changes. Your infrastructure matches the configuration.
+
+Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.
+```
diff --git a/src/tfcloud-setup/terraform.tf b/src/tfcloud-setup/terraform.tf
new file mode 100644
index 0000000..b37d82c
--- /dev/null
+++ b/src/tfcloud-setup/terraform.tf
@@ -0,0 +1,21 @@
+terraform {
+ required_providers {
+ tfe = {
+ source = "hashicorp/tfe"
+ version = "~> 0.48.0"
+ }
+
+ github = {
+ source = "integrations/github"
+ version = "~> 5.37.0"
+ }
+ }
+}
+
+provider "tfe" {
+ token = var.tfe_token
+}
+
+provider "github" {
+ token = var.github_admin_token
+}
diff --git a/src/tfcloud-setup/tfcloud-resources.md b/src/tfcloud-setup/tfcloud-resources.md
new file mode 100644
index 0000000..c94d5c5
--- /dev/null
+++ b/src/tfcloud-setup/tfcloud-resources.md
@@ -0,0 +1,35 @@
+# Create Terraform Cloud Resources
+
+We'd like Terraform to deploy the Terraform Cloud organization, a project within that organization, and a workspace within that project. Further, by linking the GitHub repository with the workspace, we can demonstrate Terraform Cloud's ability to automatically plan and apply changes made by commits to that repository.
+
+To start with, copy and paste the following into `organization.tf` to create the Terraform Cloud Organization, replacing the placeholder values with ones that will work for you. This will also create an OAuth client so that Terraform can watch for and react to commits to GitHub repositories.
+
+```hcl
+{{#include organization.tf}}
+```
+
+Next, copy and paste the following into `tfcloud_variables.tf`. The resources below manage common variable sets that hold the various credentials needed for both Terraform Cloud and the GitHub Terraform provider to interact with their respective APIs:
+
+```hcl
+{{#include tfcloud_variables.tf}}
+```
+
+Next, copy and paste the following into `tfcloud_mgmt_project.tf` to create the Terraform Cloud project and workspace along with the associated GitHub repository. This also creates a workspace-scoped "variable set" resource to hold the credentials that Terraform Cloud will need in order to interact with both the Terraform Enterprise API and GitHub API. We follow Hashicorp's [recommended practice](https://developer.hashicorp.com/terraform/tutorials/cloud/cloud-multiple-variable-sets) of scoping the variable sets as narrowly as possible; we don't want any old project or workspace in our organization to be able to make changes to the Terraform Cloud organization.Again, you'll need to replace the placeholder values with ones that will work for you:
+
+```hcl
+{{#include tfcloud_mgmt_project.tf}}
+```
+
+Running `terraform apply` should show that 12 resources need to be created, so go ahead and confirm to get things set up!
+
+```sh
+$ terraform apply
+...
+Plan: 12 to add, 0 to change, 0 to destroy.
+...
+Apply complete! Resources: 12 added, 0 changed, 0 destroyed.
+```
+
+Congratulations! You now have a Terraform Cloud organization, project and workspace configured. You also have a GitHub repository that is linked up to that workspace.
+
+Notice that in your current working directory there is a file called `terraform.tfstate` which holds the state of your Terraform Cloud configuration as far as your local `terraform` considers it. Alas, Terraform Cloud itself knows nothing of this state of affairs. Next we'll perform a state migration which is how we get your local copy of the state into Terraform Cloud.
diff --git a/src/tfcloud-setup/tfcloud-state-migration.md b/src/tfcloud-setup/tfcloud-state-migration.md
new file mode 100644
index 0000000..e5ab7b8
--- /dev/null
+++ b/src/tfcloud-setup/tfcloud-state-migration.md
@@ -0,0 +1,42 @@
+# Migrate Local State to Terraform Cloud
+
+Edit `terraform.tf`, adding the following inside the existing `terraform {}` block:
+
+ ```hcl
+ terraform {
+ ...
+ cloud {
+ organization = "your_tfcloud_org_name"
+
+ workspaces {
+ name = "tfcloud-mgmt-prod"
+ }
+ }
+ }
+ ```
+
+Initialize Terraform again, and confirm that you want the current (local) state to be migrated to the Terraform Cloud Workspace:
+
+```sh
+$ terraform init
+
+Initializing Terraform Cloud...
+Do you wish to proceed?
+ As part of migrating to Terraform Cloud, Terraform can optionally copy your
+ current workspace state to the configured Terraform Cloud workspace.
+
+ Answer "yes" to copy the latest state snapshot to the configured
+ Terraform Cloud workspace.
+
+ Answer "no" to ignore the existing state and just activate the configured
+ Terraform Cloud workspace with its existing state, if any.
+
+ Should Terraform migrate your existing state?
+
+ Enter a value: yes
+...
+Terraform Cloud has been successfully initialized!
+...
+```
+
+With the state migration complete, you can safely remove the `cloud{}` block that was temporarily added above; this is ignored by Terraform Cloud when the workspace is being managed by a VCS integration like GitHub.
diff --git a/src/tfcloud-setup/tfcloud_mgmt_project.tf b/src/tfcloud-setup/tfcloud_mgmt_project.tf
new file mode 100644
index 0000000..99e145c
--- /dev/null
+++ b/src/tfcloud-setup/tfcloud_mgmt_project.tf
@@ -0,0 +1,41 @@
+resource "github_repository" "tfcloud_mgmt" {
+ name = "tfcloud-mgmt"
+ auto_init = true
+ gitignore_template = "Terraform"
+ license_template = "mit"
+
+ lifecycle {
+ prevent_destroy = true
+ }
+}
+
+resource "tfe_project" "tfcloud_mgmt" {
+ organization = tfe_organization.example.id
+ name = "tfcloud-mgmt"
+}
+
+resource "tfe_workspace" "tfcloud_mgmt_prod" {
+ name = "tfcloud-mgmt-prod"
+ organization = tfe_organization.example.id
+ project_id = tfe_project.tfcloud_mgmt.id
+
+ tag_names = [
+ "tfcloud-mgmt",
+ "prod"
+ ]
+
+ vcs_repo {
+ identifier = github_repository.tfcloud_mgmt.full_name
+ oauth_token_id = tfe_oauth_client.example_github.oauth_token_id
+ }
+}
+
+resource "tfe_workspace_variable_set" "tfcloud_mgmt_prod_tfcloud_common_credentials" {
+ workspace_id = tfe_workspace.tfcloud_mgmt_prod.id
+ variable_set_id = tfe_variable_set.tfcloud_common_credentials.id
+}
+
+resource "tfe_workspace_variable_set" "tfcloud_mgmt_prod_tfcloud_github_provider_credentials" {
+ workspace_id = tfe_workspace.tfcloud_mgmt_prod.id
+ variable_set_id = tfe_variable_set.github_provider_credentials.id
+}
diff --git a/src/tfcloud-setup/tfcloud_mgmt_repo.tf b/src/tfcloud-setup/tfcloud_mgmt_repo.tf
new file mode 100644
index 0000000..0eac38e
--- /dev/null
+++ b/src/tfcloud-setup/tfcloud_mgmt_repo.tf
@@ -0,0 +1,3 @@
+resource "github_repository" "tfcloud_mgmt" {
+ name = "tfcloud-mgmt"
+}
diff --git a/src/tfcloud-setup/tfcloud_variables.tf b/src/tfcloud-setup/tfcloud_variables.tf
new file mode 100644
index 0000000..b211618
--- /dev/null
+++ b/src/tfcloud-setup/tfcloud_variables.tf
@@ -0,0 +1,51 @@
+
+resource "tfe_variable_set" "tfcloud_common_credentials" {
+ organization = tfe_organization.example.id
+ name = "tfcloud-common-credentials"
+ description = "Common credentials required for all tfcloud projects/workspaces"
+}
+
+resource "tfe_variable" "tfcloud_common_tfe_token" {
+ category = "terraform"
+ key = "tfe_token"
+ sensitive = true
+ description = "Terraform Enterprise API Token"
+ value = "Manually set to avoid storing in TF state"
+ variable_set_id = tfe_variable_set.tfcloud_common_credentials.id
+
+ lifecycle {
+ ignore_changes = [value]
+ }
+}
+
+resource "tfe_variable" "tfcloud_mgmt_gh_ro_token" {
+ category = "terraform"
+ key = "github_ro_token"
+ sensitive = true
+ description = "GitHub PAT for triggering runs"
+ value = "Manually set to avoid storing in TF state"
+ variable_set_id = tfe_variable_set.tfcloud_common_credentials.id
+
+ lifecycle {
+ ignore_changes = [value]
+ }
+}
+
+resource "tfe_variable_set" "github_provider_credentials" {
+ organization = tfe_organization.example.id
+ name = "github-admin-credentials"
+ description = "Credentials required for the GitHub Terraform provider"
+}
+
+resource "tfe_variable" "tfcloud_mgmt_gh_admin_token" {
+ category = "terraform"
+ key = "github_admin_token"
+ sensitive = true
+ description = "GitHub PAT for creating and deleting repositories"
+ value = "Manually set to avoid storing in TF state"
+ variable_set_id = tfe_variable_set.github_provider_credentials.id
+
+ lifecycle {
+ ignore_changes = [value]
+ }
+}
diff --git a/src/tfcloud-setup/variables.tf b/src/tfcloud-setup/variables.tf
new file mode 100644
index 0000000..20fc1be
--- /dev/null
+++ b/src/tfcloud-setup/variables.tf
@@ -0,0 +1,14 @@
+variable "github_admin_token" {
+ type = string
+ sensitive = true
+}
+
+variable "github_ro_token" {
+ type = string
+ sensitive = true
+}
+
+variable "tfe_token" {
+ type = string
+ sensitive = true
+}
diff --git a/src/tfcloud-setup/vcs-workflow-integration.md b/src/tfcloud-setup/vcs-workflow-integration.md
new file mode 100644
index 0000000..d040f2f
--- /dev/null
+++ b/src/tfcloud-setup/vcs-workflow-integration.md
@@ -0,0 +1,39 @@
+# VCS Workflow Integration
+
+With the state now managed in Terraform Cloud, and the workspace configured to watch for changes in the tfcloud-mgmt repository, we're in a position to commit our code to the GitHub repository and confirm that everything's working as expected.
+
+## Set Credentials Variables
+
+As you'll have seen from the configuration in `tfcloud_mgmt_project.tf`, given their very sensitive nature, we deliberately keep the GitHub and Terraform Cloud API tokens out of the Terraform state; the configuration of the variables is tracked by Terraform but their values are not. For similar security reasons, our local copy of `credentials.auto.tfvars` won't be committed to the repository. So, at this point, Terraform Cloud doesn't have a copy of the API keys it needs in order to successfully interact with both Terraform Cloud itself and with GitHub.
+
+Using the Terraform Cloud UI, update the 3 variables with the values you have stored locally in `credentials.auto.tfvars`
+
+## Commit Code To The `tfcloud-mgmt` Repository
+
+As the `tfcloud-mgmt-prod` workspace has been integrated with the GitHub repository, that repo is now the single source of truth for the state of your infrastructure.
+
+If you go to the workspace in the Terraform Cloud UI, you'll notice that a run has already been triggered and that it errored with the following:
+
+`Error: No Terraform configuration files found in working directory`
+
+That's clear evidence that it's treating the repo as that source of truth; the repo has no code in it yet. Let's fix that:
+
+```sh
+cd ../
+git clone https://github.com/your-github-org-name/tfcloud-mgmt
+cd tfcloud-mgmt
+cp ../tfcloud-mgmt-scratch/*.tf
+git add .
+git commit -m "Add tfcloud-mgmt resources"
+git push
+```
+
+Visiting the workspace in the Terraform Cloud UI, you should see a run be queued then the plan running. It should finish with no changes being detected. This now proves that the state, as managed by Terraform Cloud, is up to date with the code in the GitHub repository.
+
+## Tidy up
+
+With everything committed to the repo, we can clean up the scratch directory we were previously working from. Now would be a good opportunity to backup the various API tokens in your password manager of choice as they currently only exist in `credentials.auto.tfvars` in your local scratch directory and in Terraform Cloud as sensitive write-only variables. Once backed up, remove the scratch directory:
+
+```sh
+rm -r ../tfcloud-mgmt-scratch
+```