LogoLogo
  • Welcome
  • Overview
    • Architecture
      • API Server
      • Sizing
    • Dashboard Overview
    • Monitoring Concepts
      • Application Performance Management
        • Availability Monitoring
        • Performance Intelligence
        • Service Level Management
        • Synthetic Transaction Management
        • Alerts Management
        • Reporting & Analytics
      • Infrastructure Monitoring
      • Unified Monitoring
    • Automation Concepts
      • Definition of Terms
      • Infrastructure as Code
        • Project Structure and Organization
        • Setting Up IaC Environment
        • Infrastructure Provisioning
        • Configuration Management
      • SAP Basis Automation
      • Automated Migration
  • User Guide
    • Onboarding
    • Setup
      • Gateway Setup
        • Gateway Network Setup
        • IT-Conductor Gateway Setup on Windows
        • IT-Conductor Gateway Setup on Linux
        • IT-Conductor Gateway Setup on AWS
        • IT-Conductor Gateway Setup on Azure
        • IT-Conductor Gateway Setup for SAP Secure Network Communications (SNC)
      • API Server Setup
      • MSP Tenant Setup
      • SSO Setup
        • Azure ADFS Identity Provider
        • Azure Active Directory (AAD) App Gallery
    • Monitoring
      • General
        • Maintenance Mode
          • Manual Maintenance
          • Scheduled Maintenance
        • Central Syslog Server Monitoring
        • URL Monitoring Locations
      • Cloud Monitoring
        • AWS Monitoring
        • Microsoft Azure Monitoring
      • Database Monitoring
        • IBM DB2 Database Monitoring
        • Microsoft SQL Server Monitoring
        • Oracle Database Monitoring
        • SAP HANA System Monitoring
          • SAP HANA Scale-Out Monitoring
          • SAP HANA Overview Dashboard
          • SAP HANA Alert Management
        • SAP ASE Database Monitoring
        • SAP MaxDB Monitoring
        • HA/DR Monitoring
      • Infrastructure Monitoring
        • File Server Monitoring
          • File Watcher Monitoring
        • Git Server
        • OS Monitoring
          • Unix/Linux System Monitoring
            • Linux Network Interface Monitoring
            • OS Printer Monitoring
          • Windows System Monitoring
            • WinRM Adapter Configuration
              • WinRM Services Configuration
              • Domain User Access
              • WMI Namespace Access
              • Windows Service Configuration
        • VMWare vCenter Monitoring
      • SAP Monitoring
        • Business Process Monitoring
          • Business Process Composer
          • BDoc Monitoring
          • IDoc Monitoring
        • SAP BusinessObjects Monitoring
          • SAP BO Data Services Monitoring
        • SAP Cloud Connector Monitoring
        • SAP Host Agent Monitoring
        • SAP NetWeaver Monitoring
          • SAP ABAP System Monitoring
            • SAP Transports
            • Security Role Import
            • SAP ABAP Overview Dashboard
            • SAP CCMS Alert Monitoring
            • SAP Batch Jobs Monitoring
              • SAP Batch Job Monitoring for CCMS Alerts
              • Advanced SAP Batch Job Monitoring
            • SAP SLT & RFC Connection Monitoring
            • Print Spooler Monitoring
            • Workload Monitoring
              • Transaction Code Monitoring
              • SAP Workload Monitoring
          • SAP J2EE System Monitoring
            • SAP J2EE Monitoring Role
            • Keystore Views and Certificates Monitoring
            • SAP PO Application Monitoring
          • SAP Systems Administrator Panel
        • SAP Web Dispatcher Monitoring
        • LMDB Discovery
        • Team-Based Central SAP Download Manager
    • Automation
      • Migration
        • Oracle to AWS Migration
        • Oracle to ASE Migration
        • SAP on MSSQL to AWS Migration
        • S/4HANA to Cloud Migration
      • E2E System Refresh Automation
        • Frequently Asked Questions
      • Age-based HANA Backup Automation
      • Inbound/Outbound Queue Restart Automation
      • OS File System Cleanup Automation
      • OS Linux Pacemaker Cluster Error Management
      • OS Printer Queue Restart Automation
      • OS Linux Kernel Patching using ChAI
      • OS Linux System Reboot using ChAI
      • SAP Batch Job Restart on Error
      • SAP Kernel Update using ChAI
      • SAP HANA Account Activation using ChAI
      • SAP Transports using ChAI
        • Frequently Asked Questions
      • SAP User Unlock and Password Reset Automation
      • Start/Stop Automation
    • Reporting
      • Available Reports
      • Creating Reports
        • Service Health KPI Report
      • Scheduling Reports
        • Automated HANA Reports
      • Report Elements
      • Archived Alerts Reporting
    • Account Administration
      • Invite Users
      • Create Robot Users
      • Update Linux System Account Password After Expiration
    • Notifications
      • Alerts
      • Threshold Overrides
        • Threshold Overrides Variables
      • Notification Targets
      • Distribution Lists
      • Subscriptions
      • Custom SMTP Notification Providers
      • Integration Providers
        • Derdack EA Integration
        • ilert Integration
        • Jira Service Desk Integration
        • Microsoft Teams Integration
        • PagerDuty Integration
        • Slack Integration
      • On-Call Scheduling
      • Calendar Events
    • Diagnostics
      • Gateway Communication Dump Debug Mode
      • Running IT-Conductor Gateway from CLI
      • SAP CCMS Missing Data
    • IT-Conductor FLUX
    • SID-Refresh
      • Product Overview
      • Getting Started
      • Documentation
      • Release Notes
      • Frequently Asked Questions
      • Troubleshooting Guide
        • Component CRM_MIDDLEWA_CRM - CRM Middleware Configuration
        • Failure to Start the Java-based GUI
        • Inconsistencies found in the table TADIR
        • Java-based GUI Runs with Pixelated Fonts
        • No email message is created after sending an email in SO01
        • Program Run as root
        • SICF Wrong Credentials
        • SU01: Error in user management
        • External Resources
      • Pricing
  • Release Notes
    • Gateway
  • References
    • Open-Source Software
    • Support
Powered by GitBook
On this page
  • Directory Structure
  • Naming Conventions
  • Repository Layout
  1. Overview
  2. Automation Concepts
  3. Infrastructure as Code

Project Structure and Organization

When handling projects, it's important to establish a well-organized directory structure to effectively manage your project and potential complexities. It's recommended to maintain distinct directories for various purposes and ensure a uniform format, style, and code structure.

Directory Structure

The recommended directory structure for any IaC project includes separating code, configuration, and documentation into organized folders. By following an organized directory structure, you make it easier for team members to locate and manage specific elements of your IaC project, maintain consistency, and collaborate effectively. It also facilitates version control and ensures that your project remains clear, maintainable, and scalable.

  • Root Directory: The root directory of your IaC project typically contains high-level configuration files and important project-wide documentation. It may include files like "main.tf" (for Terraform) or "site.yml" (for Ansible) as the entry point for your IaC code.

  • Code Directory: This is where you store the actual IaC code. You should create subdirectories for different components or environments. For example, you may have subdirectories like "networking," "servers," or "dev," "staging," and "production" if you're managing different environments.

  • Configuration Directory: This directory is meant for configuration files that are separate from the IaC code. These can include environment-specific configurations, application settings, or any other data that needs to be kept separate from the code logic. Store configuration files that are separate from your IaC code in this directory.

  • Documentation Directory: It's a good practice to have a dedicated folder for documentation. This directory should contain files explaining the project's purpose, architecture, and usage, along with any user or developer guides.

  • Modules/Scripts Directory: If your IaC project is sufficiently complex, you may want to have a directory specifically for reusable modules, scripts, or functions. These can be shared and included in your code as needed.

  • Variables Directory: Store variable definitions in a dedicated directory. This can help keep variables separate from the code logic and make it easier to manage and change configurations.

  • Tests Directory: If your IaC project includes automated tests (highly recommended), place your test files or scripts in this directory. This helps ensure code reliability.

  • Infrastructure State Directory: Some IaC tools maintain state files that track the current state of deployed resources. Keep these files in a separate directory to prevent accidental modifications.

  • Secrets Directory (Optional): For security and separation of concerns, you may consider having a separate directory for managing secrets and sensitive data. Ensure strict access controls on this folder.

  • Logs and Reports Directory (Optional): If your IaC project generates logs or reports, you can have a directory for storing these files.

  • Bin or Scripts Directory (Optional): If you have utility scripts or binaries that assist in the IaC process, place them in this directory.

Note: An IaC project typically undergoes multiple iterations to align with a company's specific project requirements, and its initial definition may not be entirely accurate.

Naming Conventions

Establishing clear and consistent naming conventions for resources, files, and directories within your IaC project is crucial for enhancing project maintainability.

Here are some key considerations:

  • Resource Naming Conventions: Resources like servers, databases, and networking components should have names that reflect their purpose and attributes. For example, use meaningful names like “web-server” or “database-prod” to make the resource context more evident.

  • File Naming Conventions: Maintain a consistent approach to naming your IaC files. For example, if you’re using Terraform, use a prefix like “main.tf” for your primary configuration file, and then use descriptive file names for additional modules or configurations, such as “networking.tf” or “security-groups.tf”.

  • Consistency Across Environments: Maintain consistency in naming across different environments (e.g., development, staging, production) to avoid confusion. For example, if you use “app-server-dev”, use “app-server-staging” and “app-server-prod” for similar resources in other environments.

  • Version Control Branch and Tag Naming: When managing your IaC project in version control (e.g., Git), consider naming branches and tags with descriptive names that indicate the purpose of a branch or release version. For example, use “feature/add-ssl” or “v1.2-release”.

  • Use of Hyphens or Underscores: Choose either hyphens or underscores for separating words in names. Stick with one style throughout your project for consistency. For example, either only use hyphens as in “web-server” or underscores as in “web_server”.

  • Avoid Special Characters and Spaces: Steer clear of special characters, spaces, and other non-alphanumeric characters in names, as they can lead to compatibility issues or confusion.

Repository Layout

Organizing your IaC code within your version control repository is essential for maintaining an efficient version control repository for your IaC project, making collaboration, version management, and project tracking smoother and more effective.

Here's a guide on how your IaC code should be structured within a version control repository, including best practices for branches and folders:

Branches

  • Master/Main Branch: The primary branch (often named "master" or "main") should contain the production-ready code. It should be stable and protected, allowing only approved changes to be merged into it.

  • Feature Branches: For each new feature, enhancement, or bug fix, create a dedicated feature branch. Use clear and descriptive names, such as "feature/add-load-balancer" or "bugfix/fix-database-connection."

  • Environment-Specific Branches: Maintain branches for different environments, such as "staging" or "development." These branches can be used for environment-specific configurations.

  • Release Branches: When preparing for a new release, create a release branch (e.g., "release/v1.0"). Only bug fixes and essential changes should be merged into release branches.

  • Hotfix Branches: For critical issues in production, create hotfix branches (e.g., "hotfix/ssl-certificate-expiry") to address and deploy immediate fixes.

Folder

  • Code Folder: Organize your IaC code within a dedicated folder to keep it separate from other project assets.

  • Modules Folder: If you use reusable modules, create a "modules" folder to store them.

  • Variables Folder: Keep variable definitions in a "variables" folder for clarity.

  • Tests Folder: Store your test files or scripts in a "tests" folder to ensure that your code is thoroughly tested.

  • Documentation Folder: Include a folder for documentation. This is where you can store architecture diagrams, user guides, and other project documentation.

Note: Unlike a directory, which can store files, subdirectories, and other directories, a folder can only store files.

Versioning

  • Semantic Versioning: Adhere to semantic versioning principles for your IaC code to clearly communicate the impact of changes. Versions typically follow the format “X.Y.Z”, where:

    • X is a major version

    • Y is a minor version

    • Z is a patch version

  • Tags for Releases: Tag releases with version numbers (e.g., "v1.0.0") to make it easy to reference specific releases in the future.

  • Commit Messages: Write informative and concise commit messages. Describe the purpose of the change, its impact, and any relevant details. Follow a consistent style guide for commit messages.

  • Pull Request Reviews: Require code reviews for all pull requests. This ensures that changes are thoroughly examined and conform to project standards.

PreviousInfrastructure as CodeNextSetting Up IaC Environment

Last updated 1 year ago