agentleFS
Microsoft AzureKnown publisherAzure/sap-automation/.github/copilot-instructions.md

sap-automation

Copilot instructions145 starsChanged 3 months agoMITView on GitHub

SDAF is Microsoft's open-source framework for deploying and configuring SAP landscapes on Azure. It provisions infrastructure with Terraform and configures the OS/database/SAP application layers with Ansible, driven from Azure DevOps/GitHub Actions pipelines, from a .NET web app (Webapp/) that manages deployment configuration, or via localized script execution — running the deploy/scripts/ entry points (e.g. install_deployer.sh, installer.sh, deploy_controlplane.sh) directly from a shell, without any pipeline or the Webapp involved. Consumers are SAP Basis/infra teams standing up dev/QA/prod SAP systems (HANA and…

  • Installs packages

The file

Show its rules and text

We split this copilot-instructions.md into the rules it gives an agent

14 rules. About 0 are common, 9 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When reviewing a pull request or a diff in this repository, use the code-review agent skill in .github/skills/code-review/ for changes to …

    line 22
  2. Distinctive:

    Terraform / HashiCorp: follow the official Terraform documentation and Terraform language style guide for module structure, resource …

    line 39
  3. Distinctive:

    AzureRM / AzAPI providers: follow the AzureRM provider docs and AzAPI provider docs for resource arguments and

    line 44
  4. Distinctive:

    Ansible: follow the official Ansible best practices guide and ansible-lint documentation.

    line 48
  5. Distinctive:

    Python: follow PEP 8 and the official Black documentation for formatting, and official pytest / pytest-cov docs for

    line 51
  6. Distinctive:

    .NET / ASP.NET Core: follow official Microsoft Learn guidance.

    line 56
  7. Very specific:

    Azure services: follow official Azure best practices — when Azure MCP tools are available (see Webapp/.github/copilot-instructions.md), …

    line 58
  8. Distinctive:

    When a claim about "what the docs say" matters, verify it by fetching and reading the actual current documentation page rather than relying …

    line 62
  9. Distinctive:

    Use underscores, not hyphens, in Terraform identifiers (hyphens are fine inside actual Azure resource names/strings).

    line 100
  10. Very specific:

    Every root module (run/{sap_deployer,sap_landscape,sap_library,sap_system}, bootstrap/{sap_deployer,sap_library}) has a tests/ directory …

    line 110
  11. Distinctive:

    Add/update these test cases alongside any Terraform change to a root module.

    line 113
  12. Very specific:

    All Python code in the repo — Ansible filter_plugins/lookup_plugins and the deploy/scripts/py_scripts/ CLIs — is tested with pytest, with …

    line 162
  13. Very specific:

    When adding or modifying a Python file anywhere in deploy/, add or update its corresponding test under tests/deploy/<same relative …

    line 167
  14. Distinctive:

    Formatting: all Python files (source and tests) must be formatted with

    line 171

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Copilot Instructions — SAP Deployment Automation Framework (SDAF)

Project overview

SDAF is Microsoft's open-source framework for deploying and configuring SAP landscapes on Azure. It provisions infrastructure with Terraform and configures the OS/database/SAP application layers with Ansible, driven from Azure DevOps/GitHub Actions pipelines, from a .NET web app (Webapp/) that manages deployment configuration, or via localized script execution — running the deploy/scripts/ entry points (e.g. install_deployer.sh, installer.sh, deploy_controlplane.sh) directly from a shell, without any pipeline or the Webapp involved. Consumers are SAP Basis/infra teams standing up dev/QA/prod SAP systems (HANA and AnyDB) across any Azure region. See docs/repository_overview.md for the full architecture, module map, and data flow.

The Webapp subdirectory has its own Webapp/.github/copilot-instructions.md for Azure-tool usage rules — those apply only when working under Webapp/; this file covers the rest of the repo and general cross-cutting rules.

When reviewing a pull request or a diff in this repository, use the code-review agent skill in .github/skills/code-review/ for changes to Terraform modules, Ansible roles and playbooks, deployer shell scripts, Python helpers, and GitHub Actions workflows. It defines the review dimensions in priority order — correctness, reliability/SRE, security, Azure/SAP domain rules, performance, testing coverage, maintainability — along with the evidence bar and the known false-positive classes for this repo. The skill does not cover Webapp/ (.NET); review those changes against the Webapp/.github/copilot-instructions.md guidance instead.

Strict requirement: follow official best practices

For every technology in this repo, changes must follow the official best practices from that technology's own documentation — not conventions inferred from blog posts, Stack Overflow, or general training knowledge. Concretely:

When a claim about "what the docs say" matters, verify it by fetching and reading the actual current documentation page rather than relying on memory or a search-result snippet — do not assert a documented value or practice without a direct quote from the source.

Tech stack

  • Terraform (deploy/terraform/) — Azure infrastructure. Providers: azurerm, azapi. Pinned versions live in each module's providers.tf; check that file rather than assuming a version here, and update it (not this doc) when bumping providers.
  • Ansible (deploy/ansible/) — OS, database, and SAP application configuration, driven by numbered playbooks.
  • ASP.NET Core / .NET 9.0 (Webapp/) — configuration UI backed by Azure Table Storage.
  • Bash / PowerShell / Python (deploy/scripts/) — deployment orchestration scripts invoked by pipelines or run manually.
  • Azure DevOps pipelines (deploy/pipelines/) and GitHub Actions (.github/workflows/) for CI/CD and linting/testing.

Critical rule: never run terraform fmt

This repo intentionally uses wide, column-aligned = signs in all .tf files (not the default tight alignment terraform fmt produces). Do not run terraform fmt or any auto-formatter on Terraform files — it will destroy the existing alignment and produce massive unrelated diffs. When editing .tf files by hand, match the surrounding alignment style.

Terraform conventions (deploy/terraform/)

  • Root (entry-point) modules live under run/{sap_deployer,sap_library, sap_landscape,sap_system} and bootstrap/{sap_deployer,sap_library}. Reusable child modules live under terraform-units/modules/ and are referenced by relative path from root modules.
  • Each root module follows a consistent file layout: module.tf, providers.tf, backend.tf, variables_global.tf, variables_local.tf, tfvar_variables.tf, transform.tf, output.tf, imports.tf. Put complex/derived logic in variables_local.tf, not inline in resources.
  • Use underscores, not hyphens, in Terraform identifiers (hyphens are fine inside actual Azure resource names/strings).
  • Known provider aliases: azurerm.main, azurerm.dnsmanagement, azurerm.privatelinkdnsmanagement, azapi.restapi.
  • Validate changes with (no state, no fmt):
    cd deploy/terraform/run/<module>   # or deploy/terraform/bootstrap/<module>
    terraform init -backend=false
    terraform validate
  • Every root module (run/{sap_deployer,sap_landscape,sap_library,sap_system}, bootstrap/{sap_deployer,sap_library}) has a tests/ directory with plan_shape.tftest.hcl and validation.tftest.hcl, using mock_provider. Add/update these test cases alongside any Terraform change to a root module. Run tests with:
    cd deploy/terraform/run/<module>   # or deploy/terraform/bootstrap/<module>
    terraform init -backend=false
    terraform test
    Note: terraform test's mock_provider cannot mock ephemeral resources, so CI temporarily rewrites ephemeral "azurerm_key_vault_secret" to data "azurerm_key_vault_secret" on the checked-out runner copy only (never committed) before running tests in modules that read secrets via an ephemeral key vault secret. Production code always uses ephemeral — don't "fix" this by changing production code to data.
  • Lint with tflint (.tflint.hcl — terraform + azurerm ruleset plugins):
    tflint --chdir=deploy/terraform --recursive --minimum-failure-severity=error
  • CI also runs a checkov static scan and a terraform-docs drift check. Reusable modules under terraform-units/modules/ have generated README.md files — never hand-edit them; regenerate with:
    terraform-docs -c deploy/terraform/terraform-units/modules/.terraform-docs.yml markdown <module>

Ansible conventions (deploy/ansible/)

  • Playbooks are numbered sequentially (playbook_00_validate_parameters.yaml … playbook_08_...yaml) reflecting deployment phase order — preserve this numbering when adding new playbooks/tasks.
  • Roles are split by concern into roles-os/ (OS 1.x), roles-sap-os/ (SAP OS 2.x), roles-db/ (DB 4.x: HANA/Oracle/DB2/ASE), roles-sap/ (SAP app 5.x), roles-misc/ (utilities 0.x), each using X.Y-description naming.
  • Lint before proposing changes (mirrors CI):
    pip install ansible-core==2.16.* ansible-lint==24.9.2 jmespath netaddr
    ansible-galaxy collection install ansible.windows ansible.posix ansible.utils \
        ansible.netcommon:5.1.2 community.windows community.general:11.4.1 microsoft.ad --force
    ansible-lint deploy/ansible -c .ansible-lint
  • .ansible-lint intentionally skips some rules — don't "fix" those without checking the skip list first.
  • Preserve the existing SUSE Pacemaker self-key authorization pattern; it's a required part of the SLES 16 implementation — don't remove it.
  • There are no Molecule tests. Python-level tests for Ansible filter/lookup plugins live under the top-level tests/ tree — see Python testing below.

Python testing (tests/)

All Python code in the repo — Ansible filter_plugins/lookup_plugins and the deploy/scripts/py_scripts/ CLIs — is tested with pytest, with test files collected in a top-level tests/ directory that mirrors the source tree (tests are not colocated with the source they test).

When adding or modifying a Python file anywhere in deploy/, add or update its corresponding test under tests/deploy/<same relative path>/test_<name>.py rather than colocating the test next to the source.

  • Formatting: all Python files (source and tests) must be formatted with black before committing:
    black deploy/ tests/
  • Coverage: a minimum of 85% code coverage is required. Run tests with coverage and verify the threshold before proposing changes:
    pytest tests/ -v --cov=deploy --cov-report=term-missing --cov-fail-under=85

Web application (Webapp/)

  • ASP.NET Core (.NET 9.0) MVC app backed by Azure Table Storage; see Webapp/.github/copilot-instructions.md for Azure-tool-usage rules that apply here (use Azure MCP tools, invoke azmcp_bestpractices_get first).
  • Build: dotnet build Webapp/SDAF/SDAFWebApp.csproj.

General formatting

  • Line endings: LF for .sh/.tf/.tfvars/.yml/.yaml, CRLF for .ps1 (enforced via .gitattributes) — don't normalize across these.
  • Indentation per .editorconfig: 2 spaces default, 4 spaces for Python/C#, tabs for shell scripts.
  • Trailing whitespace is trimmed everywhere except .md/.diff.

Project structure

  • deploy/terraform/run/ : root Terraform modules (entry points), one per deployment stage (sap_deployer, sap_library, sap_landscape, sap_system).
  • deploy/terraform/bootstrap/ : first-time/local-backend variants of sap_deployer and sap_library used before remote state exists.
  • deploy/terraform/terraform-units/modules/ : reusable child modules referenced by the root modules; each has generated README.md files (via terraform-docs) — don't hand-edit these.
  • deploy/ansible/ : numbered playbooks (playbook_00_... – playbook_08_...) plus roles-os/, roles-sap-os/, roles-db/, roles-sap/, roles-misc/.
  • deploy/scripts/ : Bash/PowerShell/Python orchestration scripts invoked by pipelines or run manually (see Resources below).
  • deploy/pipelines/ : Azure DevOps pipeline YAML for the full deployment lifecycle (control plane → workload zone → SAP system → install → removal).
  • Webapp/ : ASP.NET Core configuration UI (has its own copilot instructions).
  • docs/ : architecture and reference documentation, including repository_overview.md.

Resources

  • deploy/scripts/deploy_controlplane.sh / deploy_control_plane_v2.sh : end-to-end control plane (deployer + library) deployment.
  • deploy/scripts/install_deployer.sh, install_library.sh, install_workloadzone.sh, installer.sh : stage-by-stage deployment entry points; remove_controlplane.sh / remove_control_plane_v2.sh for teardown.
  • deploy/scripts/py_scripts/SDAF-GitHub-Actions/ : Python CLI for scaffolding GitHub Actions-based deployments.
  • .github/workflows/ : CI — terraform-checks.yml (validate/tflint/test/ checkov/terraform-docs), github-actions-ansible-lint.yml, codeql.yml, trivy.yml.
  • docs/repository_overview.md : full architecture, module map, and data flow — consult this before making cross-cutting changes.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.