Code Monkey home page Code Monkey logo

terraform-fun's Introduction

terraform-fun

Hacks, notes and experiments with HashiCorp Terraform

Samples

  • hello-world: Creates an Azure Resource Group.
  • vm-demo: Creates a Windows VM in Azure and configures IIS.
  • appservice-to-vm: An App Services using an existing database in a VM.
  • tshirt-sizes: terraform 0.11 style for parametrizing from a table.
  • dsc-automation-vm: use Azure Automation to install a VSTS Agent.
  • carving-subnets: using cidrsubnet and cidrhost to statically assign IP addresses.
  • convey-params: pushing parameters from Terraform to Powershell via azurerm_virtual_machine_extension.
  • uploader: script to upload files to Azure Storage.
  • zipping: how to use archive_file to create a local Zip.
  • invoke-arm: use of azurerm_template_deployment.
  • appservice-to-vm: complex Azure example that shows an App Service using a SQL Server instance hosted in a VM (scenario of green field application using a legacy database).
  • agnostic-modules Cloud agnostic code: how to abstract and decouple from Terraform providers.

Files not in repo

Set-AzureRMSecrets.ps1 sets the environment variables required by Terraform to act on Azure

# pro-demo / terraformfun
$env:ARM_ACCESS_KEY = "***"
# Subscription ID
$env:ARM_SUBSCRIPTION_ID = "******"
# Directory ID
$env:ARM_TENANT_ID = "******"
# Application ID (terraform-fun)
$env:ARM_CLIENT_ID = "******"
# Key $env:ComputerName exp. $(Get-Date)
$env:ARM_CLIENT_SECRET = "********"

Permissions

Can use two Service Principals (aka Applications) terraform-contrib and terraform-reader

Service Principal Resource Role / Access policy
terraform-contrib Subscription Contributor
terraform-contrib pro-demo KeyVault Get & List Secrets
terraform-reader Subscription Reader
terraform-reader pro-demo KeyVault Get & List Secrets

The latter can be shared "freely", the former can do damage (planning is key).

Some example, notably agnostic-modules, requires additional accounts and permissions.

terraform-fun's People

Contributors

giuliov avatar

Watchers

James Cloos 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.