Metadata-Version: 2.4
Name: netherframe.discovery.hashicorp.aws
Version: 0.3.0
Summary: AWS resource discoverer for Netherframe using HashiCorp AWS provider
Author: Netherframe Contributors
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Systems Administration
Requires-Dist: netherframe-core>=0.12.0,<1.0.0
Requires-Dist: boto3[crt]>=1.44.4
Requires-Dist: botocore>=1.44.4
Requires-Dist: orjson>=3.13.0 ; extra == 'dev'
Requires-Dist: pytest>=9.2.0 ; extra == 'dev'
Requires-Dist: pytest-mock>=3.17.0 ; extra == 'dev'
Requires-Python: >=3.14
Project-URL: Homepage, https://netherframe.arsenal.sh
Project-URL: Repository, https://github.com/arsenal-sh/netherframe
Provides-Extra: dev
Description-Content-Type: text/markdown

# AWS Resource Discoverer for Netherframe

This package provides AWS resource discovery capabilities for Netherframe using the HashiCorp AWS provider.

## Installation

```bash
pip install netherframe.discovery.hashicorp.aws
```

## Usage

```python
from nf.core import App, Stack
from nf.core.infrastructure.discovery import ResourceDiscoveryManager
from nf.discovery.hashicorp.aws import AWSDiscoverer

# Create discovery manager
discovery = ResourceDiscoveryManager([AWSDiscoverer()])

# One region per call; credentials come from the environment, ~/.aws or explicit config keys
aws_config = {"region": "us-east-1"}

# Create app and stack
app = App(nf_id="app")
stack = Stack(nf_scope=app, nf_id="imported_infrastructure")

# Discover and fold resources
resources, imports = discovery.discover_and_fold(
    stack=stack,
    provider_source="hashicorp/aws",
    config=aws_config,
    filters={"resource_types": ["aws_vpc", "aws_instance", "aws_s3_bucket"], "tags": {"Environment": "production"}},
)

print(f"Discovered {len(resources)} resources")
```

Or from the command line: `nf discover resources aws --region us-east-1`.

## Supported Resource Types

Discovery supports 1750 resource types and 6 AWS load balancer aliases. The [comprehensive guide](README_COMPREHENSIVE.md#supported-resources) lists every type, and the
[coverage report](COVERAGE_REPORT.md) compares them with the Terraform AWS provider.

Coverage against provider 6.73.0 is **1,756/1,766 types (99.4%)**, with **246/252 services**
complete. This includes all pinned SageMaker (39), Security Hub (20), Transfer Family (13),
IAM Identity Center administration (15), and Transcribe (4) resource types, plus QuickSight
(26), Lightsail (23), Network Manager (21), VPC Lattice (15), and FSx (12). Complete
services also include Bedrock AgentCore (21), WorkSpaces Secure Browser (18), SES (14),
SES v2 (14), Bedrock (12), Bedrock Agent (9), and Neptune (9). Another 75 types complete
Connect (17), DMS (11), DataZone (11), REST API Gateway (26), Classic ELB (9), global
WAF Classic (12), and WAF Regional Classic (13). Another 79 advertised types complete RDS
(30), Network Firewall (9), Network Security Manager (6), Storage Gateway (10), WorkSpaces
(5), Image Builder (9), EMR (8), Observability Admin (9), Notifications (8), DynamoDB (10)
and ELBv2 (14, including six ALB aliases). This includes the new listener-certificate alias.
A further 56 types complete Audit Manager (8), Oracle Database@AWS (8), CloudWatch Omni
(7), FinSpace (7), Kendra (6), Lex V2 Models (6), Pinpoint (12), S3 (26), and WAFv2 (9).
FinSpace retains the pinned historical API contract after AWS retirement; current endpoint
availability is not implied. WAFv2 API-key discovery requires literal credential opt-in
because its native import identity contains the key. A further 58 types complete Auto Scaling
(9), Bedrock Data Automation (3), Cost Explorer (4), Clean Rooms (3), Direct Connect (19),
ECS (11), Elasticsearch (4), Evidently (4), Lambda Web (4), MediaLive (5), Secrets Manager
(5), Cloud Map (5), Service Quotas (4), Verified Permissions (5), and WorkMail (5).
Evidently also uses an isolated official historical API model; coverage does not establish
live availability. Direct Connect's four additional observations and the legacy Elasticsearch
policy have no native importer. Standalone tag ownership follows the actual selected types,
and withheld configuration or unknown preservation inputs remain explicit before an apply.

The preceding 57 canonical additions brought the registry to 430 spec modules. They added
Synthetics/Signer, CodeCatalyst, Timestream, Lambda Core/MicroVM, ARC plans, Budgets,
Chatbot, RUM, administrative account settings and the remaining readable certificate,
connection, type-version, snapshot-copy, trigger and operation-history lifecycles.
Necessary metadata reads still establish actual occurrences when private bodies are withheld;
original creation inputs and native first-plan limitations stay explicit. CodeCatalyst-only
selection validates its official bearer session; mixed/default selection keeps AWS STS.
Native no-import observations are never advertised as adoption tokens.

Five further bindings bring the registry to 432 spec modules: Grafana v10 legacy API-key
metadata through an explicitly authenticated administrative HTTP GET, and four Lex V1
definitions restricted to GovCloud West/FIPS. Grafana needs existing per-workspace token
files and original TTL inputs; its key resource has no importer. Lex's scoped documentation
conflicts with the general retirement notice, so coverage does not qualify any account's
current availability. The comprehensive guide explains both boundaries.

These are provider-binding coverage counts, not a count of currently available live AWS
types. See [live inventory and retired-service limits](COVERAGE_REPORT.md#provider-bindings-and-current-live-aws-availability)
for the source-backed exceptions; historical SDK support does not establish current service availability.

These inventories read administrative configuration; private definition bodies require
the documented opt-in, and unreturned origins, credentials and lifecycle choices stay explicit.
Object variants outside a pinned schema are reported; unreadable creation inputs remain explicit arguments
to supply, and an observed resource without a native importer is identified as such.

The [packaged live-inventory exception ledger](netherframe/discovery/hashicorp/aws/live_inventory_exceptions.json) records the exact
three declarations without a qualified service-inventory reader and seven retired-service
declarations still missing. Raw
coverage remains 1,756/1,766. The coverage scripts' `--require-live-complete` gate checks
remaining live-scope gaps and rejects advertising an excluded declaration as supported;
it does not claim that every historical binding has a currently operational AWS endpoint.
Explicitly requesting a remaining unavailable type produces a structured availability
notice, without a synthetic resource. A known-unavailable-only request creates no AWS
session or authentication call; mixed requests continue their supported inventory.
The five bounded readers also return private-safe scope, authentication or incomplete-
inventory notices, without changing their supported-type status or hiding actual results.

## Configuration Options

### AWS Credentials

The discoverer supports multiple credential methods:

1. **Environment variables**: `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` (or `AWS_PROFILE`)
2. **AWS credentials file and instance roles**, through the default boto3 credential chain
3. **Explicit credentials**: Provide `access_key_id`, `secret_access_key` and optionally `session_token` in config

### Filtering

You can filter discovered resources using:

- **Types**: `{'resource_types': ['aws_vpc', 'aws_subnet']}`
- **Tags**: `{'tags': {'Environment': 'prod', 'Team': 'backend'}}`
- **Per-type filters**, e.g. `{'vpc_ids': [...]}`, `{'bucket_names': [...]}`, `{'api_names': [...]}`

### Secrets

Secrets the AWS API never returns, and credentials that are only emitted on request (see
`README_COMPREHENSIVE.md`), are listed in each resource's `metadata["arguments_to_supply"]`;
the CLI and `discover_and_fold()` tell you which arguments to supply.

## Requirements

- Python 3.14+
- boto3
- netherframe.core
