Metadata-Version: 2.4
Name: netherframe.backends.aws
Version: 0.2.0
Summary: AWS backend implementations for Netherframe
Author: Sourabh Cheedella
Author-email: Sourabh Cheedella <cheedella.sourabh@gmail.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Systems Administration
Requires-Dist: netherframe-core>=0.9.0
Requires-Dist: boto3>=1.44.4
Requires-Dist: botocore>=1.44.4
Requires-Dist: pytest>=9.2.0 ; extra == 'dev'
Requires-Dist: requests>=2.34.2 ; 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

# nf.backends.aws

AWS backend implementations for Netherframe Infrastructure as Code framework.

## Installation

```bash
pip install netherframe.backends.aws
```

## Usage

```python
from nf.backends.aws import S3Backend

# For Terraform synthesis mode
backend = S3Backend(nf_scope=stack, bucket="my-terraform-state", key="infrastructure/terraform.tfstate", region="us-east-1", dynamodb_table="terraform-locks")

# Backend config values must be literal strings. You may pass Resource objects
# if their input attributes are literal (for example, bucket=state_bucket).
# Output references like state_bucket.output.id are not supported for Terraform
# backend configuration.

# For native execution mode
state_backend = S3Backend.for_native(bucket="my-terraform-state", key="infrastructure/terraform.tfstate", region="us-east-1", dynamodb_table="terraform-locks")
```

## Features

- S3-based state storage with optional DynamoDB locking
- Compatible with Terraform's S3 backend
- Support for encryption (SSE-S3 and SSE-KMS)
- State locking to prevent concurrent modifications
- Automatic stale lock detection and cleanup, and force-unlock by lock ID (`nf state force-unlock`)
- Conditional writes: a write replaces only the state version its run read (conditional put on the object's ETag)
- Pre-apply checkpoints kept beside the state (`<key>.checkpoints/`)


## Bootstrap security

`S3BackendBootstrapper.bootstrap()` treats its bucket as dedicated state storage:
it explicitly enables all four S3 public-access blocks and BucketOwnerEnforced
ownership, and adds a scoped deny for non-TLS non-service requests. The service
exception avoids relying on redacted service-to-service network context.
Encryption/versioning remain enabled as configured; state history is not expired.

Existing policy statements/document metadata are preserved. A conflicting
Netherframe transport-policy Sid, malformed policy, failed read or legacy ACL
ownership stops before security-control writes. Migrate legacy ownership
explicitly rather than disabling ACLs on a shared bucket without review. The
bootstrap identity needs read/write permissions for these bucket controls.
This API manages backend controls; don't also declare competing bucket-policy
writers in an application stack. No transport policy is proof of a successful
recovery or of effective account-level permissions. `validate()` still checks
resource existence only, not full security compliance. No new runtime modules
or architecture topology are introduced.
