Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.11'

- name: Update version file
run: |
echo "${{ github.ref_name }}" | sed 's/^v//' > VERSION

- name: Install dependencies
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install build twine

- name: Build package
run: |
python setup.py sdist bdist_wheel
python -m build

- name: Publish to PyPI
env:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,6 @@ dotenv
.venv/

# Claude AI local settings
.claude/settings.local.json
.claude/settings.local.json

uv.lock
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ To install FTF CLI from source, follow these steps:
2. **Create a virtual environment** (recommended):

```bash
python -m venv env
source env/bin/activate # On Windows use `env\Scripts\activate`
uv sync
source .venv/bin/activate # On Windows use `.venv\Scripts\activate`
```

3. **Install the package**:
Expand Down Expand Up @@ -126,6 +126,7 @@ ftf add-variable [OPTIONS] /path/to/module
- Preserves terraform formatting while adding variables.
- Performs type validation before addition.
- Nested variables create the necessary nested structure internally.
- Pattern properties support regex validation for dynamic keys.

#### Validate Directory

Expand All @@ -137,10 +138,11 @@ ftf validate-directory /path/to/module [OPTIONS]

**Options**:
- `--check-only`: Only check formatting; does not make any changes.
- `--skip-terraform-validation`: Skip Terraform validation steps if set to true.

**Notes**:
- Runs `terraform fmt` for formatting verification.
- Runs `terraform init` to ensure initialization completeness.
- Runs `terraform init` to ensure initialization completeness (unless skipped).
- Uses Checkov to scan Terraform files for security misconfigurations.
- Designed for fast feedback on module quality and security.

Expand Down Expand Up @@ -209,6 +211,8 @@ ftf preview-module /path/to/module [OPTIONS]
- `-g, --git-repo-url`: Git repository URL where the module source code resides.
- `-r, --git-ref`: Git ref, branch, or tag for the module version.
- `--publish`: Flag to publish the module immediately after preview.
- `--skip-terraform-validation`: Skip Terraform validation steps if set to true.
- `--skip-output-write`: Do not update the output type in facets. Set to true only if you have already registered the output type before calling this command.

**Notes**:
- Environment variables such as GIT_REPO_URL, GIT_REF, FACETS_PROFILE can be used for automation or CI pipelines.
Expand Down Expand Up @@ -249,6 +253,7 @@ Automatically discovers resources in the module and prompts for selecting a reso
- `--resource`: The Terraform resource address to import (e.g., 'aws_s3_bucket.bucket').
- `--index`: For resources with 'count', specify the index (e.g., '0', '1', or '*' for all).
- `--key`: For resources with 'for_each', specify the key (e.g., 'my-key' or '*' for all).
- `--resource-address`: The full resource address to import (e.g., 'azurerm_key_vault.for_each_key_vault[0]'). If provided, runs in non-interactive mode and skips resource discovery.

**Examples**:
```bash
Expand Down Expand Up @@ -292,7 +297,7 @@ ftf delete-module [OPTIONS]
- `-i, --intent`: (prompt) Intent of the module to delete.
- `-f, --flavor`: (prompt) Flavor of the module.
- `-v, --version`: (prompt) Version of the module.
- `-s, --stage`: (prompt) Deployment stage of the module.
- `-s, --stage`: (prompt) Deployment stage of the module (choices: "PUBLISHED", "PREVIEW").
- `-p, --profile`: (prompt) Authentication profile to use (default: "default").

#### Get Output Types
Expand Down
49 changes: 49 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[build-system]
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"

Comment on lines +1 to +4
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Potential versioning conflict: setuptools_scm vs dynamic.version

Including setuptools_scm[toml] implies you want SCM-based versions, yet [tool.setuptools.dynamic] version = {file = "VERSION"} overrides that mechanism.
Choose one source of truth to avoid ambiguous versions on PyPI.

🤖 Prompt for AI Agents
In pyproject.toml lines 1 to 4, there is a conflict between using setuptools_scm
for SCM-based versioning and the dynamic version set from a VERSION file. To fix
this, decide on a single versioning method: either remove setuptools_scm from
the requires list if you want to use the VERSION file approach, or remove the
dynamic.version configuration if you prefer setuptools_scm. Ensure only one
version source is configured to avoid ambiguity.

[project]
name = "ftf-cli"
description = "Facets Terraform Cli"
authors = [
{name = "Sanmesh Kakade", email = "sanmesh.kakade@facets.cloud"}
]
keywords = ["Facets", "CLI", "Terraform"]
readme = "README.md"
requires-python = ">=3.11"
dynamic = ["version"]

dependencies = [
"Click",
"Jinja2",
"PyYAML",
"checkov",
"jsonschema",
"requests",
"questionary",
"facets-hcl",
"ruamel.yaml",
]

[project.optional-dependencies]
dev = [
"pytest>=8.3.5",
"pytest-mock",
"pyhcl>=0.4.5",
]

[project.urls]
Homepage = "https://github.com/Facets-cloud/module-development-cli"
Repository = "https://github.com/Facets-cloud/module-development-cli"

[project.scripts]
ftf = "ftf_cli.cli:cli"

[tool.setuptools.packages.find]
include = ["ftf_cli", "ftf_cli.commands", "ftf_cli.commands.templates"]

[tool.setuptools]
include-package-data = true

[tool.setuptools.dynamic]
version = {file = "VERSION"}
46 changes: 0 additions & 46 deletions setup.py

This file was deleted.