GithubHelp home page GithubHelp logo

gsoft-inc / terraform-azurerm-naming Goto Github PK

View Code? Open in Web Editor NEW
24.0 4.0 11.0 92 KB

Terraform Azure RM Module for naming resources and resource groups following Microsoft's naming guidelines.

License: Apache License 2.0

HCL 94.92% JavaScript 2.47% Mustache 2.61%
terraform terraform-module azure naming-conventions

terraform-azurerm-naming's Introduction

terraform-azurerm-naming

Terraform Module for naming Azure resources and resource groups following Microsoft's naming guidelines.

Note: Since this module is comprised of multiple sub-modules, you need to reference them in a particular fashion.

Why Use This?

  1. Abstract the hassle of knowing which resource type needs to follow which naming convention (length, dashes or no dashes, etc.)
  2. Make it easier to follow naming conventions
  3. Follow best pratices such as suffixing with a random string to avoid name collisions

Example Usage

provider "azurerm" {
  features {}
}

variable "location" {
    default = "eastus2"
}

module "resource_group_name" {
  source   = "gsoft-inc/naming/azurerm//modules/general/resource_group"
  name     = "example"
  prefixes = ["organization", "project", "production"]
}

module "storage_account_name" {
  source   = "gsoft-inc/naming/azurerm//modules/storage/storage_account"
  name     = "example"
  prefixes = ["org", "proj", "prod"]
}

resource "azurerm_resource_group" "example" {
  name     = module.resource_group_name.result
  location = var.location
}

resource "azurerm_storage_account" "example" {
  name                     = module.storage_account_name.result
  resource_group_name      = azurerm_resource_group.example.name
  location                 = var.location
  account_kind             = "StorageV2"
  account_tier             = "Standard"
  account_replication_type = "LRS"
}

This example would result into something like this:

  • organization-project-production-example-35xvzaq251lja (resource group)
    • org0proj0prod0example01x (storage account)

Note: Random suffix is automatically generated but can but overriden.

Updating the module

terraform get -update

License

Copyright © 2021, GSoft inc. This code is licensed under the Apache License, Version 2.0. You may obtain a copy of this license at https://github.com/gsoft-inc/gsoft-license/blob/master/LICENSE.

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.