Skip to content

Instantly share code, notes, and snippets.

@yohanb
Last active October 24, 2019 17:28
Show Gist options
  • Save yohanb/680b77d3becd3a089454affddbc997a1 to your computer and use it in GitHub Desktop.
Save yohanb/680b77d3becd3a089454affddbc997a1 to your computer and use it in GitHub Desktop.

Revisions

  1. yohanb revised this gist Oct 24, 2019. 1 changed file with 0 additions and 4 deletions.
    4 changes: 0 additions & 4 deletions simple_rg_naming.tf
    Original file line number Diff line number Diff line change
    @@ -3,10 +3,6 @@ locals {
    prj = "rockets"
    env = "staging"
    suffix = "01234"
    naming = {
    regex = "^[-\\w\\._\\(\\)]+$",
    max_length = 90
    }
    }

    resource "azurerm_resource_group" "example" {
  2. yohanb revised this gist Oct 24, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion simple_rg_naming.tf
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,6 @@ locals {

    resource "azurerm_resource_group" "example" {
    name = # Value on next line for readability
    regex(local.naming.regex, substr("rg-${local.org}-${local.prj}-${local.env}-main-${local.suffix}", local.naming.max_length))
    regex("^[-\\w\\._\\(\\)]+$",substr("rg-${local.org}-${local.prj}-${local.env}-main-${local.suffix}", 90))
    location = "eastus"
    }
  3. yohanb revised this gist Oct 24, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions simple_rg_naming.tf
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ locals {
    }

    resource "azurerm_resource_group" "example" {
    name = #Value on next line for readability
    regex(local.naming.regex, substr("rg-${local.org}-${local.prj}-${local.env}-main-${local.suffix}", local.naming.max_length))
    name = # Value on next line for readability
    regex(local.naming.regex, substr("rg-${local.org}-${local.prj}-${local.env}-main-${local.suffix}", local.naming.max_length))
    location = "eastus"
    }
  4. yohanb revised this gist Oct 24, 2019. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion simple_rg_naming.tf
    Original file line number Diff line number Diff line change
    @@ -3,9 +3,14 @@ locals {
    prj = "rockets"
    env = "staging"
    suffix = "01234"
    naming = {
    regex = "^[-\\w\\._\\(\\)]+$",
    max_length = 90
    }
    }

    resource "azurerm_resource_group" "example" {
    name = #Value on next line for readability
    regex("^[-\\w\\._\\(\\)]+$",substr("rg-${local.org}-${local.prj}-${local.env}-main-${local.suffix}", 90))
    regex(local.naming.regex, substr("rg-${local.org}-${local.prj}-${local.env}-main-${local.suffix}", local.naming.max_length))
    location = "eastus"
    }
  5. yohanb revised this gist Oct 24, 2019. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion simple_rg_naming.tf
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,7 @@ locals {
    suffix = "01234"
    }
    resource "azurerm_resource_group" "example" {
    name = regex("^[-\\w\\._\\(\\)]+$",substr("rg-${local.org}-${local.prj}-${local.env}-main-${local.suffix}", 90))
    name = #Value on next line for readability
    regex("^[-\\w\\._\\(\\)]+$",substr("rg-${local.org}-${local.prj}-${local.env}-main-${local.suffix}", 90))
    location = "eastus"
    }
  6. yohanb created this gist Oct 24, 2019.
    10 changes: 10 additions & 0 deletions simple_rg_naming.tf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    locals {
    org = "acme"
    prj = "rockets"
    env = "staging"
    suffix = "01234"
    }
    resource "azurerm_resource_group" "example" {
    name = regex("^[-\\w\\._\\(\\)]+$",substr("rg-${local.org}-${local.prj}-${local.env}-main-${local.suffix}", 90))
    location = "eastus"
    }