Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Terraform Module to create Resource Groups with Locks. Makes use of terraform_azurerm_regions_type1 to validate location.

License

Notifications You must be signed in to change notification settings

rmsmatos/terraform_azurerm_resourcegroups_locks_type1

Repository files navigation

Terraform

README

This is the link to Cloud This is the CHANGELOG file This is the NOTICE file This is the LICENSE file

Azure regions module

This Terraform module is designed to help in using the AzureRM terraform provider.

It provides for an Azure region given in standard format, CLI format or slug format and returns Azure standard format, a short format used for resource naming, the CLI format, a slug format and a fixed 4 character name.

This work is widely based on [Claranet terraform_azurerm_regions] (https://github.com/claranet/terraform-azurerm-regions).

Please refer to the regions.tf file for available regions. Complete regions mapping is also available in REGIONS.md documentation.

Requirements

Name Version
terraform >= 1.5.0
azurerm >= 3.66.0

Providers

Name Version
azurerm >= 3.66.0

Modules

Name Source Version
azurerm_resourcegroup_type1 github.com/rmsmatos/terraform_azurerm_resourcegroup_type1 v1.0.0

Resources

Name Type
azurerm_management_lock.lock resource

Inputs

Name Description Type Default Required
location (Required) The Azure Region where the Resource Group should exist. Changing this forces a new Resource Group to be created. string n/a yes
name (Required) The Azure Region where the Resource Group should exist. Changing this forces a new Resource Group to be created string n/a yes
lock_level (Required) Specifies the Level to be used for this RG Lock. Possible values are Empty (no lock), CanNotDelete and ReadOnly. string "CanNotDelete" no
lock_name (Optional) Specifies a named for this Resource Group Lock. string "Locked by Terraform module on creation" no
lock_notes Sets a description on the Resource Group Lock. string "Resource Group was locked by Terraform module" no
managed_by (Optional) The ID of the resource or application that manages this Resource Group. string null no
tags (Optional) A map of strings for tagging the resource. Changing this updates the resource. map(string) null no

Outputs

Name Description
id Returns Resource Group ID.
location Returns Resource Group Location.
lock_id Returns Resource Group Lock ID.
lock_level Returns Resource Group Lock Level
lock_name Returns Resource Group Lock Name.
lock_notes Returns Resource Group Lock Note.
lock_scope Returns Resource Group Lock scope
name Returns Resource Group Name.
tags Returns Resource Group Tags.

Example

terraform {
  required_version = ">= 1.5.3"
}

module "terraform_azurerm_resourcegroups_lock_type1" {
  source   = "github.com/rmsmatos/terraform_azurerm_resourcegroups_lock_type1"
  name     = "just-a-test"
  location = "westeurope"
  tags = {
    environment = "production"
    costcentre  = "cost center"
  }
  lock_name  = "Lockek by Terraform"
  lock_level = "CanNotDelete"
  lock_notes = "We don't want people to delete this"
}

output "id" {
  value = module.terraform_azurerm_resourcegroups_lock_type1.location
}

output "name" {
  value = module.terraform_azurerm_resourcegroups_lock_type1.name
}

output "tags" {
  value = module.terraform_azurerm_resourcegroups_lock_type1.tags
}

output "managed_by" {
  value = module.terraform_azurerm_resourcegroups_lock_type1.managed_by
}

output "lock_id" {
  value = module.terraform_azurerm_resourcegroups_lock_type1.lock_id
}

output "lock_name" {
  value = module.terraform_azurerm_resourcegroups_lock_type1.lock_name
}

output "lock_scope" {
  value = module.terraform_azurerm_resourcegroups_lock_type1.lock_scope
}

output "lock_level" {
  value = module.terraform_azurerm_resourcegroups_lock_type1.lock_level
}

output "lock_notes" {
  value = module.terraform_azurerm_resourcegroups_lock_type1.lock_notes
}

Related documentation

Azure regions: azure.microsoft.com/en-us/global-infrastructure/regions/

Authors

Created and maintained by Rui Matos.
©Rui Matos 2023

License

This source code is licensed under the Apache-2.0 license found in the LICENSE file in the root directory of this source tree license (./LICENSE.md).


About

Terraform Module to create Resource Groups with Locks. Makes use of terraform_azurerm_regions_type1 to validate location.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages