Skip to content

Instantly share code, notes, and snippets.

View straubt1's full-sized avatar
💭
Terraform All The Things

Tom Straub straubt1

💭
Terraform All The Things
View GitHub Profile
@straubt1
straubt1 / debug.log
Created March 17, 2018 21:56
terraform-provider-azurerm:azurerm_function_app
2018/03/17 16:34:20 [INFO] Terraform version: 0.11.4 7878d66b386e5474102b5047722c2de2b3237278
2018/03/17 16:34:20 [INFO] Go runtime version: go1.10
2018/03/17 16:34:20 [INFO] CLI args: []string{"/usr/local/Cellar/tfenv/0.6.0/versions/0.11.4/terraform", "apply", "--auto-approve"}
2018/03/17 16:34:20 [DEBUG] Attempting to open CLI config file: /Users/REDACTED/.terraformrc
2018/03/17 16:34:20 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2018/03/17 16:34:20 [INFO] CLI command args: []string{"apply", "--auto-approve"}
2018/03/17 16:34:20 [INFO] command: empty terraform config, returning nil
2018/03/17 16:34:20 [DEBUG] command: no data state file found for backend config
2018/03/17 16:34:20 [DEBUG] New state was assigned lineage "a2f5e219-9ab1-393f-192e-0e4c8efe354d"
2018/03/17 16:34:20 [INFO] command: backend initialized: <nil>
data "azurerm_subscription" "primary" {}
resource "random_string" "password" {
length = 32
special = true
}
locals {
spn_name = "tfexample"
spn_expire = "2020-01-01T00:00:00Z"
resource "azurerm_virtual_machine" "myvm" {
name = "myvm0"
resource_group_name = "my-rg"
vm_size = "Standard_A2_v2"
location = "centralus"
network_interface_ids = ["${azurerm_network_interface.myvm.id}"]
storage_image_reference {
publisher = "MicrosoftWindowsServer"
offer = "WindowsServer"
variable "data_disks" {
default = [
{
lun = 0
size = 32
},
{
lun = 1
size = 128
},
resource "azurerm_virtual_machine" "main" {
name = "myvm0"
...Some fields omitted...
dynamic "storage_data_disk" {
for_each = var.data_disks
content {
name = "datadisk${storage_data_disk.value.lun}"
dynamic "storage_data_disk" {
for_each = var.data_disks
content {
name = "datadisk${storage_data_disk.value.lun}"
lun = storage_data_disk.value.lun
disk_size_gb = storage_data_disk.value.size
create_option = "Empty"
managed_disk_type = "Standard_LRS"
}
storage_data_disk {
name = "datadisk0"
lun = 0
disk_size_gb = 32
create_option = "Empty"
managed_disk_type = "Standard_LRS"
}
storage_data_disk {
name = "datadisk1"
lun = 1
@straubt1
straubt1 / locks-existingterraform.tf
Created August 20, 2018 17:04
Terraform Azure Management Locks
resource "azurerm_resource_group" "main" {
name = "cardinal-rg"
location = "centralus"
}
resource "azurerm_management_lock" "resource-group-level" {
name = "resource-group-level"
scope = "${azurerm_resource_group.main.id}"
lock_level = "ReadOnly"
notes = "This Resource Group is Read-Only"
@straubt1
straubt1 / tfe-sso-application.tf
Created February 19, 2020 20:54
Base configuration for using Terraform to manage the SSO Application
locals {
tfe_application_name = "tfe"
tfe_application_url = "https://tfe.company.com"
spn_url = "https://some_url.com"
tfe_teams = [
"app1-team-dev",
"app1-team-admin",
"app2-team-dev",
"app3-team-admin",
@straubt1
straubt1 / main.tf
Created February 20, 2020 14:03
[Terraform] Azure Storage Account Soft Delete
resource "random_pet" "name" {
length = 3
separator = ""
}
resource "azurerm_resource_group" "example" {
name = random_pet.name.id
location = "centralus"
}