feat: add Terraform configuration and initialization scripts for Azure backend
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
storage
|
||||
test
|
||||
**/.terraform
|
||||
**/.terraform.lock.hcl
|
||||
Caddyfile
|
||||
*.env
|
||||
|
||||
4
test/backend.config
Normal file
4
test/backend.config
Normal file
@@ -0,0 +1,4 @@
|
||||
storage_account_name = "terraform"
|
||||
container_name = "tfstate"
|
||||
key = "test.tfstate"
|
||||
use_azuread_auth = true
|
||||
3
test/init.sh
Executable file
3
test/init.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
terraform init -backend-config backend.config
|
||||
35
test/main.tf
Normal file
35
test/main.tf
Normal file
@@ -0,0 +1,35 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
azurerm = {
|
||||
source = "hashicorp/azurerm"
|
||||
}
|
||||
|
||||
random = {
|
||||
source = "hashicorp/random"
|
||||
}
|
||||
}
|
||||
|
||||
backend "azurerm" {}
|
||||
}
|
||||
|
||||
provider "azurerm" {
|
||||
features {}
|
||||
}
|
||||
|
||||
resource "random_password" "user1" {
|
||||
length = 12
|
||||
min_lower = 1
|
||||
min_upper = 1
|
||||
min_numeric = 1
|
||||
min_special = 1
|
||||
special = true
|
||||
override_special = "!@#$"
|
||||
}
|
||||
|
||||
resource "terraform_data" "password" {
|
||||
input = random_password.user1.result
|
||||
}
|
||||
|
||||
output "user1" {
|
||||
value = terraform_data.password.output
|
||||
}
|
||||
Reference in New Issue
Block a user