Git Product home page Git Product logo

tfx-vmp's Introduction

tfc-vmp

It's assumed you have access to a Terraform service platform such as Terraform Enterprise (TFE) or Terraform Cloud(TFC).

Vending Machine Pattern (VMP) for creating an organisation, workspaces, and teams on a Terraform service platform (TFC/TFE)

This Terraform root module is based on the concepts of Crawl -> Walk -> Run, so it also includes steps to bootstrap this repo into the initial workspace in your organization.

Requirements

Access to the TFC || TFE platform with an organization https://developer.hashicorp.com/terraform/cloud-docs/users-teams-organizations/organizations and a user token https://developer.hashicorp.com/terraform/cloud-docs/users-teams-organizations/users#api-tokens

The terraform client installed locally https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli

A git fork or clone of this repository in a publicly source-able project.

Bootstrapping

Before you can connect a Version Control Service (VCS) based workflow you need a VCS connection in TFC/TFE. https://developer.hashicorp.com/terraform/enterprise/vcs

You may or may not need SSH keys (optional)https://developer.hashicorp.com/terraform/enterprise/vcs/github#step-4-on-terraform-cloud-set-up-ssh-keypair-optional

Once you have a VCS connection configured traverse to the ./modules/bootstrap folder and read the README.md there.

Usage

One you have completed the bootstrapping this project provides resources to then build workspaces, policy_sets and further team access.

This project is to facilitate a demonstration of terraform service capabilities allowing for rapid deployment and removal of the resources.

The examples follow the learnings from https://developer.hashicorp.com/terraform/cloud-docs/recommended-practices

Examples

Due to the nature of this project the Examples folder contains declarative examples, and some examples for additional usage or illustration.

Policy Sets (Sentinel) Deployment

The example includes dynamic resources for deploying policy_set resources.

The variable configure_policy_set will deploy the initial generic policy set <./policy_sets/generic/sentinel.hcl>

Additionally configuring sentinel_vcs_repo_identifier=<git organization>/<git project> or sentinel_vcs_repo_identifier = $(git config --get remote.origin.url | cut -d : -f2 | cut -d'.' -f1) will then deploy the <./policy_sets/storage_validation/sentinel.hcl> from this repository has source.

These variable should be set in the Terraform service UI (TFC/TFE) https://developer.hashicorp.com/terraform/cloud-docs/workspaces/variables/managing-variables

NOTE: The policies referenced are only available over a pubic HTTPS endpoint

Destroy and Destruction

The resources listed below are created as part of a standard Version Control Service (VCS) driven workflow during the bootstrapping process.

To destroy the resources you will require sufficient access to the created workspace vmp_workspace. Follow the documentation https://developer.hashicorp.com/terraform/tutorials/cloud-get-started/cloud-destroy?in=terraform%2Fcloud-get-started

Once the resources are destroyed you can run a Terraform client based destroy using the bootstrap folder, or simply remove the workspace.

Requirements

Name Version
tfe 0.38.0

Providers

Name Version
tfe 0.38.0
tfe.organization 0.38.0

Modules

No modules.

Resources

Name Type
tfe_agent_pool.test-agent-pool resource
tfe_agent_token.test-agent-token resource
tfe_policy_set.generic resource
tfe_policy_set.vmp_vcs_storage_validation resource
tfe_team.component-env resource
tfe_team_access.component-env resource
tfe_workspace.component-env resource
tfe_oauth_client.this data source
tfe_slug.generic data source

Inputs

Name Description Type Default Required
ATLAS_WORKSPACE_SLUG (Unrequired) The TF_VAR_ATLAS_WORKSPACE_SLUG is a varible within the workspace of the terraform service string "" no
TFx_org_token (Optional String) Token for the Terraform server organization level token string n/a yes
agent_pool_set (Optional Bool) Flag to control of agent pool bool false no
configure_policy_set (Optional Bool) Flag to control deployment of policy sets. bool false no
oauth_name (Required String) Name of OAuth VCS connection you created string n/a yes
sentinel_branch (Optional String) VCS repo branch defaults to main string "main" no
sentinel_vcs_repo_identifier (Optional String) username/projectname of the VCS project or repository to source policy sets string "" no
terraform_server (Optional String) defaults to app.terraform.io, but otherwise the FQDN of your TFE server string "app.terraform.io" no

Outputs

Name Description
test-agent-token n/a

tfx-vmp's People

Contributors

abuxton avatar migueldemh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.