Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Contributing

1. Fork the project and clone your fork.

2. Create a local feature branch:

$ git checkout -b <branch>

3. Do something awesome

4. Push to your fork:

$ git push origin <branch>

5. Open a pull request.
396 changes: 375 additions & 21 deletions LICENSE

Large diffs are not rendered by default.

57 changes: 39 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,39 @@
My Lovely Project
=================

A great example repo you can fork to your heart’s content, that serves as a launchpad for working your way through the amazing **[Learning GitHub](http://shop.oreilly.com/category/videos/programming.do)** video training series.

## Getting started

The first thing you want to do with this repo is quite likely **fork it**. Use the Fork button in the top-right section of the page to do this.

Once you’re on your fork, you can experiment however you like with it, play with branches, issues, milestones, labels, the wiki, and more.

## What’s in there?

Various files to support upcoming GitHub tasks the series trains you for, but more importantly, demonstration out-of-codebase contents (e.g. issues and milestones) so you can get a feeling of what features GitHub offers without having to first create such content or data. The video series frequently uses this repository as a way of touring trainees briefly through these features before tackling them.

## License

This repository is © 2015 Christophe Porteneuve, provided under the [MIT license](LICENSE), and part of a video training series produced for and distributed by O’Reilly.
# TFC Getting Started

In this repo, you'll find a quick and easy path to get started using [Terraform Cloud](https://app.terraform.io/) with the [Terraform CLI](https://github.com/hashicorp/terraform).

## What's here?

This repo contains two main things:

1. An example Terraform configuration which provisions some mock infrastructure to a fictitious cloud provider called "Fake Web Services" using the [`fakewebservices`](https://registry.terraform.io/providers/hashicorp/fakewebservices/latest) provider.
1. A [script](./scripts/setup.sh) which automatically handles all the setup required to start using Terraform with Terraform Cloud.

## Requirements

- Terraform 0.14 or higher
- The ability to run a bash script in your terminal
- [`sed`](https://www.gnu.org/software/sed/)
- [`curl`](https://curl.se/)
- [`jq`](https://stedolan.github.io/jq/)

## Usage

### 1. Log in to Terraform Cloud via the CLI

Run `terraform login` and follow the prompts to get an API token for Terraform to use. If you don't have a Terraform Cloud account, you can create one during this step.

### 2. Clone this repo

```sh
git clone https://github.com/hashicorp/tfc-getting-started.git
cd tfc-getting-started
```

### 3. Run the setup script and follow the prompts

```
./scripts/setup.sh
```

Welcome to Terraform Cloud!
13 changes: 13 additions & 0 deletions backend.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# The block below configures Terraform to use the 'remote' backend with Terraform Cloud.
# For more information, see https://www.terraform.io/docs/backends/types/remote.html
terraform {
backend "remote" {
organization = "{{ORGANIZATION_NAME}}"

workspaces {
name = "{{WORKSPACE_NAME}}"
}
}

required_version = ">= 0.14.0"
}
38 changes: 38 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# The following configuration uses a provider which provisions [fake] resources
# to a fictitious cloud vendor called "Fake Web Services". Configuration for
# the fakewebservices provider can be found in provider.tf.
#
# After running the setup script (./scripts/setup.sh), feel free to change these
# resources and 'terraform apply' as much as you'd like! These resources are
# purely for demonstration and created in Terraform Cloud, scoped to your TFC
# user account.
#
# To review the provider and documentation for the available resources and
# schemas, see: https://registry.terraform.io/providers/hashicorp/fakewebservices
#
# If you're looking for the configuration for the remote backend, you can find that
# in backend.tf.


resource "fakewebservices_vpc" "primary_vpc" {
name = "Primary VPC"
cidr_block = "0.0.0.0/1"
}

resource "fakewebservices_server" "servers" {
count = 2

name = "Server ${count.index + 1}"
type = "t2.micro"
vpc = fakewebservices_vpc.primary_vpc.name
}

resource "fakewebservices_load_balancer" "primary_lb" {
name = "Primary Load Balancer"
servers = fakewebservices_server.servers[*].name
}

resource "fakewebservices_database" "prod_db" {
name = "Production DB"
size = 256
}
13 changes: 13 additions & 0 deletions provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# The following variable is used to configure the provider's authentication
# token. You don't need to provide a token on the command line to apply changes,
# though: using the remote backend, Terraform will execute remotely in Terraform
# Cloud where your token is already securely stored in your workspace!

variable "provider_token" {
type = string
sensitive = true
}

provider "fakewebservices" {
token = var.provider_token
}
Loading