Skip to content

Commit ef8b95c

Browse files
author
Phillip Simonds
committed
Merge branch 'main' into ps-fix-create-dc-generator
2 parents 3df7db1 + b1d2cb7 commit ef8b95c

17 files changed

+2531
-11
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,13 @@ jobs:
8888
run: markdownlint "**/*.{md,mdx}"
8989

9090
integration-test:
91+
if: |
92+
always() && !cancelled() &&
93+
!contains(needs.*.result, 'failure') &&
94+
!contains(needs.*.result, 'cancelled')
9195
needs: ["python-lint", "yaml-lint", "markdown-lint"]
9296
runs-on:
9397
group: "huge-runners"
94-
strategy:
95-
fail-fast: false
96-
matrix:
97-
include:
98-
- os: ubuntu-latest
9998
timeout-minutes: 60
10099
env:
101100
INFRAHUB_DB_TYPE: neo4j
@@ -104,6 +103,8 @@ jobs:
104103
INFRAHUB_TESTING_LOG_LEVEL: INFO
105104
steps:
106105
- uses: actions/checkout@v5
106+
- name: Install tini
107+
run: "apt-get update && apt-get install -y tini"
107108
- name: Install uv
108109
uses: astral-sh/setup-uv@v7
109110
with:
@@ -114,9 +115,7 @@ jobs:
114115
RUNNER_NAME=$(echo "${{ runner.name }}" | grep -o 'ghrunner[0-9]\+' | sed 's/ghrunner\([0-9]\+\)/ghrunner_\1/')
115116
echo "PYTEST_DEBUG_TEMPROOT=/var/lib/github/${RUNNER_NAME}/_temp" >> $GITHUB_ENV
116117
- name: Run tests
117-
run: uv run pytest tests/
118-
env:
119-
REPOSITORY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118+
run: exec tini -s -g -- uv run pytest tests/
120119

121120
documentation:
122121
defaults:

.github/workflows/update-infrahub.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
5656
- name: Update testcontainers to workflow version ${{ env.INFRAHUB_VERSION }}
5757
run: |
58-
uv add infrahub-testcontainers==${INFRAHUB_VERSION}
58+
uv add --group dev infrahub-testcontainers==${INFRAHUB_VERSION}
5959
6060
- name: Prepare the branch for the update
6161
id: prepare-branch
@@ -84,4 +84,4 @@ jobs:
8484
--title "update test-containers to version ${{ env.INFRAHUB_VERSION }} against ${{ matrix.branch-name}}" \
8585
--body "This PR updates test-containers to version ${{ env.INFRAHUB_VERSION }}." \
8686
--base ${{ matrix.branch-name}} \
87-
--head ${{ env.BRANCH_NAME }}
87+
--head ${{ env.BRANCH_NAME }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
**/*.tar.xz
1616
docker-compose.yml
1717
generated-configs/
18+
infrahub_backups/
1819
infrahub_bundle_dc.egg-info
1920
infrahub-backup
2021
scripts/debug/
21-
service_catalog/.streamlit/
22+
service_catalog/.streamlit/

.vale/styles/spelling-exceptions.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ dns
2323
Docker's
2424
Dockerfile
2525
Docusaurus
26+
ENIs
2627
env
2728
envrc
2829
evolvability
@@ -47,6 +48,8 @@ mermaid
4748
namespace
4849
namespaces
4950
Netbox
51+
NICs
52+
NSGs
5053
netmiko
5154
npm
5255
OSPF
@@ -72,5 +75,7 @@ uv
7275
VIPs
7376
VLAN
7477
VLANs
78+
VNets
79+
VPCs
7580
VXLAN
7681
walkthrough

docs/docs/cloud-management.mdx

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
---
2+
title: Cloud resource management
3+
---
4+
5+
import Tabs from '@theme/Tabs';
6+
import TabItem from '@theme/TabItem';
7+
8+
This tutorial shows an example of cloud resource management schema, which provides a vendor-agnostic way to model cloud infrastructure across AWS, GCP, and Azure. You'll load sample cloud data and explore how Infrahub can serve as a unified inventory for multi-cloud environments.
9+
10+
## Overview
11+
12+
The cloud schema enables you to track:
13+
14+
- **Cloud providers** - AWS, GCP, Azure, or other cloud platforms
15+
- **Cloud accounts** - AWS accounts, GCP projects, Azure subscriptions
16+
- **Regions and availability zones** - Geographic locations and fault domains
17+
- **Virtual networks** - VPCs (AWS), VPC networks (GCP), VNets (Azure)
18+
- **Subnets** - Network segments within virtual networks
19+
- **Security groups** - Network access control rules (Security Groups, Firewall Rules, NSGs)
20+
- **Compute instances** - Virtual machines across all providers
21+
- **Network infrastructure** - Internet gateways, NAT gateways, route tables, elastic IPs
22+
- **Network interfaces** - ENIs, NICs attached to instances
23+
24+
This vendor-agnostic model allows you to manage multi-cloud infrastructure from a single source of truth, with consistent naming and relationships regardless of the underlying cloud provider.
25+
26+
## Prerequisites
27+
28+
Before starting this tutorial, ensure you have:
29+
30+
- Completed the [installation guide](./install.mdx) and have Infrahub running
31+
- Loaded the bootstrap data and schemas
32+
- Access to the Infrahub web interface at `http://localhost:8000`
33+
34+
## Loading cloud demo data
35+
36+
The demo includes sample data for all three major cloud providers with realistic infrastructure examples.
37+
38+
The easiest way to load the cloud demo is using the provided invoke task:
39+
40+
```bash
41+
uv run invoke demo-cloud
42+
```
43+
44+
This command:
45+
46+
1. Creates a new branch named `demo-cloud`
47+
2. Loads all schemas (including the cloud schema)
48+
3. Loads cloud object files with sample data for AWS, GCP, and Azure
49+
4. Displays a URL to view the cloud resources
50+
51+
## Exploring cloud resources
52+
53+
After loading the demo data, navigate to the cloud resources in the Infrahub web interface.
54+
55+
### Viewing all cloud resources
56+
57+
1. Ensure you're on the correct branch (for example, `demo-cloud`)
58+
2. Navigate to **Cloud Resource** in the left sidebar menu
59+
3. You'll see a list of all cloud resource types
60+
61+
Or access the cloud resources directly:
62+
63+
```text
64+
http://localhost:8000/objects/CloudResource?branch=demo-cloud
65+
```
66+
67+
### Sample data structure
68+
69+
The demo includes a comprehensive multi-cloud environment:
70+
71+
#### Cloud providers (3)
72+
73+
- Amazon Web Services (AWS)
74+
- Google Cloud Platform (GCP)
75+
- Microsoft Azure
76+
77+
#### Cloud accounts (12)
78+
79+
Each provider has production, staging, and development accounts:
80+
81+
- `opsmill-aws-production`, `opsmill-aws-staging`, `opsmill-aws-dev`
82+
- `opsmill-gcp-production`, `opsmill-gcp-staging`, `opsmill-gcp-dev`
83+
- `opsmill-azure-production`, `opsmill-azure-staging`, `opsmill-azure-dev`
84+
85+
#### Regions and availability zones
86+
87+
- **AWS**: US East (N. Virginia), US West (Oregon), EU West (Ireland)
88+
- **GCP**: US Central (Iowa), US East (South Carolina), Europe West (Belgium)
89+
- **Azure**: East US, West US 2, West Europe
90+
91+
Each region includes 3 availability zones.
92+
93+
#### Virtual networks (12)
94+
95+
VPCs and VNets across all accounts with various configurations:
96+
97+
- Production VPCs with public and private subnets
98+
- Staging and development networks
99+
- DNS support and hostname configuration
100+
101+
#### Compute instances (19)
102+
103+
Various instance types across all providers:
104+
105+
- Web servers, application servers, database servers
106+
- Linux and Windows instances
107+
- Different instance sizes (t3.large, m5.xlarge, n1-standard-2, Standard_D2s_v3, etc.)
108+
109+
#### Network infrastructure
110+
111+
- Internet gateways for public connectivity
112+
- NAT gateways for private subnet outbound access
113+
- Route tables for traffic routing
114+
- Elastic/static IP addresses
115+
- Network interfaces with security group associations
116+
117+
## Schema architecture
118+
119+
The cloud schema uses a hierarchical structure with clear relationships:
120+
121+
```text
122+
CloudProvider
123+
└── CloudAccount
124+
└── CloudVirtualNetwork
125+
├── CloudSubnet
126+
├── CloudSecurityGroup
127+
├── CloudInternetGateway
128+
└── CloudRouteTable
129+
130+
CloudRegion
131+
└── CloudAvailabilityZone
132+
└── CloudInstance
133+
└── CloudNetworkInterface
134+
```
135+
136+
### Key relationships
137+
138+
- **CloudAccount** belongs to a **CloudProvider** (parent relationship)
139+
- **CloudRegion** is associated with a **CloudProvider**
140+
- **CloudAvailabilityZone** belongs to a **CloudRegion** (parent relationship)
141+
- **CloudVirtualNetwork** is associated with a **CloudAccount** and **CloudRegion**
142+
- **CloudSubnet** belongs to a **CloudVirtualNetwork** (parent relationship)
143+
- **CloudInstance** is associated with a **CloudAccount**, **CloudAvailabilityZone**, and **CloudSubnet**
144+
- **CloudSecurityGroup** can be attached to **CloudInstance** and **CloudNetworkInterface**
145+
146+
### Common attributes
147+
148+
All cloud resources inherit from the `CloudResource` generic, providing:
149+
150+
- `name` - Resource name
151+
- `description` - Optional description
152+
- `cloud_id` - Provider-specific resource identifier (ARN, resource ID, etc.)
153+
- `status` - Operational status (active, stopped, provisioning, terminating, error)
154+
- `tags` - Optional tags for categorization
155+
156+
## Use cases
157+
158+
### Multi-cloud inventory
159+
160+
Use Infrahub as a single source of truth for all cloud resources:
161+
162+
- Track resources across AWS, GCP, and Azure in one place
163+
- Maintain consistent naming conventions
164+
- Link cloud resources to on-premises infrastructure
165+
166+
### Security auditing
167+
168+
Query security groups and their associations:
169+
170+
- Identify instances with specific security group configurations
171+
- Audit network access rules across all clouds
172+
- Track public IP assignments
173+
174+
### Capacity planning
175+
176+
Analyze compute resources across your cloud footprint:
177+
178+
- Count instances by type, region, or provider
179+
- Track resource utilization patterns
180+
- Plan for growth and optimization
181+
182+
### Network documentation
183+
184+
Document your cloud network architecture:
185+
186+
- Map virtual networks, subnets, and routing
187+
- Track NAT and internet gateway configurations
188+
- Document network interface assignments
189+
190+
## Next steps
191+
192+
For more information on Infrahub concepts, see:
193+
194+
- **[Understanding the concepts](./concepts.mdx)** - Core Infrahub patterns
195+
- **[Developer guide](./developer-guide.mdx)** - Extending schemas and creating transforms

docs/docs/readme.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ This documentation is organized following the [Diataxis framework](https://diata
3535
| **[User walkthrough](./user-walkthrough.mdx)** | A complete hands-on tutorial that guides you through the end-user experience: creating topologies, managing branches, running generators, creating proposed changes, and validating configurations. Perfect for learning the workflow from start to finish. |
3636
| **[Deploy a virtual lab with Containerlab](./containerlab-deployment.mdx)** | Learn how to deploy generated configurations to a virtual network lab using Containerlab. Extract device configurations and topology files from Infrahub, spin up virtual Arista cEOS switches, and test your data center fabric before production deployment. |
3737
| **[Working with security management](./security-management.mdx)** | Explore Infrahub's security management capabilities by examining firewall policies, security zones, and address objects. Learn how structured security data transforms into vendor-specific firewall configurations (Juniper JunOS) and how to modify policies safely using branches. |
38+
| **[Cloud resource management](./cloud-management.mdx)** | Manage multi-cloud infrastructure (AWS, GCP, Azure) with a vendor-agnostic schema. Load demo cloud data including accounts, regions, virtual networks, instances, and security groups. Learn how Infrahub serves as a unified inventory for cloud resources. |
3839
| **[Using the service catalog](./service-catalog.mdx)** | Learn how to use the Service Catalog web interface for simplified infrastructure provisioning. Enable the Streamlit application, navigate between branches, view existing infrastructure, and create new data centers through a guided form-based workflow that automates branch creation and generator execution. |
3940

4041
### Guides
@@ -82,6 +83,7 @@ The demo implements realistic network topologies including:
8283
- **Point of presence (POP) networks** with edge routers and peering connections
8384
- **Network segments** with load balancers and service endpoints
8485
- **Security zones and policies** with firewall rules and access control
86+
- **Cloud infrastructure** with vendor-agnostic modeling for AWS, GCP, and Azure
8587
- **Resource pools** for IP address, VLAN, and ASN allocation
8688
- **Multi-vendor support** (Arista, Juniper, Cisco, and SONiC templates)
8789
- **Automated topology generation** from abstract design definitions

docs/sidebars.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const sidebars: SidebarsConfig = {
1717
'user-walkthrough',
1818
'containerlab-deployment',
1919
'security-management',
20+
'cloud-management',
2021
'service-catalog',
2122
],
2223
},
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Cloud Providers - AWS, GCP, and Azure
2+
---
3+
apiVersion: infrahub.app/v1
4+
kind: Object
5+
spec:
6+
kind: CloudProvider
7+
data:
8+
- name: "Amazon Web Services"
9+
provider_type: aws
10+
console_url: "https://console.aws.amazon.com"
11+
organization: "AWS"
12+
13+
- name: "Google Cloud Platform"
14+
provider_type: gcp
15+
console_url: "https://console.cloud.google.com"
16+
organization: "Google Cloud"
17+
18+
- name: "Microsoft Azure"
19+
provider_type: azure
20+
console_url: "https://portal.azure.com"
21+
organization: "Azure"

0 commit comments

Comments
 (0)