infra-client/CLAUDE.md

60 lines
No EOL
1.4 KiB
Markdown

# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Overview
This is an OpenTofu configuration for managing TowerOps network monitoring resources. It uses the custom `towerops` provider to create and manage sites and devices in the TowerOps platform.
## Commands
```bash
# Initialize OpenTofu (downloads provider)
tofu init
# Preview changes
tofu plan
# Apply changes
tofu apply
# Destroy all resources
tofu destroy
# Format files
tofu fmt
# Validate configuration
tofu validate
```
## Authentication
The provider requires a TowerOps API token. Set it via:
- `terraform.tfvars` file (gitignored): `towerops_api_token = "your-token"`
- Environment variable: `export TF_VAR_towerops_api_token="your-token"`
Generate tokens from TowerOps web application under Settings → API Tokens.
## Provider Resources
### towerops_site
Represents a physical location containing network devices.
Required: `name` (2-200 chars)
Optional: `location`, `snmp_community`
### towerops_device
Represents network equipment at a site.
Required: `site_id`, `name`, `ip_address`
Optional: `description`, `monitoring_enabled` (default: true), `snmp_enabled` (default: true), `snmp_version` (default: "2c"), `snmp_port` (default: 161)
Note: Changing `site_id` forces resource replacement.
## Import Existing Resources
```bash
tofu import towerops_site.example <uuid>
tofu import towerops_device.example <uuid>
```