Skip to content

rapticore/azure-onboarding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure Infrastructure Deployment

This project provides Terraform/OpenTofu modules for deploying Azure infrastructure components including RTTM (Real-Time Threat Monitoring) and Managed Identity resources.

Prerequisites

  • OpenTofu >= 1.6.0
  • Azure CLI >= 2.0
  • Azure subscription with appropriate permissions
  • PowerShell or Bash terminal

Quick Start

Step 1: Azure Authentication

Login to Azure and set your subscription:

az login
az account set --subscription "your-subscription-id"

Step 2: Bootstrap Remote State Storage

Before deploying the main infrastructure, you need to set up Azure Storage for Terraform state management.

cd bootstrap-tfstate
tofu init
tofu plan
tofu apply

This will create:

  • Azure Storage Account
  • Blob Container for storing Terraform state
  • Necessary access permissions

Important: Note down the storage account name and container name from the output - you'll need these for the next step.

Step 3: Configure Backend

After the bootstrap completes, update the backend configuration in deployment/main.tf with your storage account details:

terraform {
  backend "azurerm" {
    storage_account_name = "your-storage-account-name"
    container_name       = "tfstate"
    key                  = "infrastructure.tfstate"
    resource_group_name  = "rg-name"
  }
}

Step 4: Configure Variables

First create local build of Function App This build will then be packaged by Terraform in zip file to deploy Function App by Zip Deploy method. You need to have Python minimum 3.12 for this

cd modules/rttm/function-app

pip install -r requirements.txt --target="./.python_packages/lib/site-packages"

Then

Copy the example variables file and customize it for your environment:

cd deployment
cp tfvars.example terraform.tfvars

Edit terraform.tfvars with your specific values:

# Example values - customize for your environment
resource_group_name = "rg-myproject-prod"
location           = "eastus"

Step 5: Deploy Infrastructure

Initialize and deploy the infrastructure:

cd deployment
tofu init
tofu plan
tofu apply

Module Documentation

RTTM Module

The Real-Time Threat Monitoring module deploys security monitoring resources in Azure.

Location: modules/rttm/

Managed Identity Module

The Managed Identity module creates and configures Azure Managed Identity resources for secure authentication.

Location: modules/managed-identity/

State Management

This project uses Azure Blob Storage as the backend for Terraform state. The state is stored remotely to enable:

  • Team collaboration
  • State locking
  • State versioning and backup
  • Secure state storage

Environment Management

To manage multiple environments (dev, staging, prod), you can:

  1. Create separate .tfvars files for each environment
  2. Use workspace-specific state keys in your backend configuration
  3. Deploy with environment-specific variable files:
tofu apply -var-file="dev.tfvars"
tofu apply -var-file="prod.tfvars"

Common Commands

# Initialize the working directory
tofu init

# Create an execution plan
tofu plan -var-file="terraform.tfvars"

# Apply the changes
tofu apply -var-file="terraform.tfvars"

# Show current state
tofu show

# Destroy infrastructure (use with caution)
tofu destroy -var-file="terraform.tfvars"

Troubleshooting

Backend Configuration Issues

  • Ensure the storage account and container exist before running tofu init
  • Verify your Azure credentials have access to the storage account
  • Check that the storage account name is globally unique

Module Issues

  • Verify all required variables are set in your .tfvars file
  • Check Azure permissions for the resources being created
  • Review the module documentation for specific requirements

Contributing

  1. Follow the existing code structure and naming conventions
  2. Update documentation when adding new features
  3. Test changes in a development environment before applying to production
  4. Use meaningful commit messages and create pull requests for review

Security Considerations

  • Never commit .tfvars files containing sensitive data to version control
  • Use Azure Key Vault for storing secrets referenced in your infrastructure
  • Regularly rotate access keys and review permissions
  • Enable Azure Security Center recommendations for deployed resources

Support

For issues or questions:

  1. Check the troubleshooting section above
  2. Review Azure and OpenTofu documentation
  3. Create an issue in the project repository with detailed error messages and steps to reproduce

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published