From d83050725f16f0c60bd49649b80ea3570ec1a736 Mon Sep 17 00:00:00 2001 From: Anuj Hydrabadi Date: Mon, 30 Jun 2025 15:23:16 +0530 Subject: [PATCH 1/2] Update README for namespace support and renamed commands - Add namespace support info to key features - Update get-output-types command with namespace examples - Rename get-output-lookup-tree to get-output-type-details - Update add-input command documentation with namespace format - Add examples for namespace usage throughout - Update register-output-type with namespace examples --- README.md | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 73 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0cb5f72..a24d1f1 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,15 @@ FTF CLI is a command-line interface (CLI) tool that facilitates module generation, variable management, validation, and registration in Terraform. +## Key Features + +- **Namespace Support**: Output types support both default (`@outputs`) and custom namespaces (e.g., `@anuj/sqs`) +- **Module Generation**: Scaffold Terraform modules with standardized structure +- **Variable Management**: Add and manage input variables with type validation +- **Output Integration**: Wire registered output types as module inputs +- **Validation**: Comprehensive validation for modules and configurations +- **Control Plane Integration**: Seamless authentication and interaction with Facets control plane + ## Installation You can install FTF CLI using pip, pipx, or directly from source. @@ -170,11 +179,21 @@ ftf add-input [OPTIONS] /path/to/module - `-n, --name`: (prompt) Name of the input variable to add in facets.yaml and variables.tf. - `-dn, --display-name`: (prompt) Human-readable display name for the input variable. - `-d, --description`: (prompt) Description for the input variable. -- `-o, --output-type`: (prompt) The type of registered output to wire as input. +- `-o, --output-type`: (prompt) The type of registered output to wire as input. Format: @namespace/name (e.g., @outputs/database, @anuj/sqs). **Notes**: - Updates facets.yaml required inputs and variables.tf accordingly. - Facilitates parametrization of modules using control plane outputs. +- Supports both default (@outputs) and custom namespaces. + +**Example**: +```bash +ftf add-input /path/to/module \ + --name queue_connection \ + --display-name "SQS Queue Connection" \ + --description "Configuration for SQS queue" \ + --output-type "@anuj/sqs" +``` #### Preview (and Publish) Module @@ -279,7 +298,7 @@ ftf delete-module [OPTIONS] #### Get Output Types -Retrieve the output types registered in the control plane for the authenticated profile. +Retrieve the output types registered in the control plane for the authenticated profile. Shows both namespace and name for each output type. ```bash ftf get-output-types [OPTIONS] @@ -288,18 +307,53 @@ ftf get-output-types [OPTIONS] **Options**: - `-p, --profile`: (prompt) Profile to authenticate as (default: "default"). -#### Get Output Lookup Tree +**Example Output**: +``` +Registered output types: +- @anuj/sqs +- @outputs/cache +- @outputs/database +``` -Retrieve the detailed lookup tree for a registered output type from the control plane. +#### Get Output Type Details + +Retrieve comprehensive details for a specific registered output type from the control plane, including properties and lookup tree. ```bash -ftf get-output-lookup-tree [OPTIONS] +ftf get-output-type-details [OPTIONS] ``` **Options**: -- `-o, --output`: (prompt) Name of the output type to query. +- `-o, --output-type`: (prompt) The output type to get details for. Format: @namespace/name (e.g., @outputs/vpc, @anuj/sqs). - `-p, --profile`: (prompt) Profile to use for authentication (default: "default"). +**Example Output**: +``` +=== Output Type Details: @anuj/sqs === + +Name: sqs +Namespace: @anuj +Source: CUSTOM +Inferred from Module: true + +--- Properties --- +{ + "attributes": { + "queue_arn": {"type": "string"}, + "queue_url": {"type": "string"} + }, + "interfaces": {} +} + +--- Lookup Tree --- +{ + "out": { + "attributes": {"queue_arn": {}, "queue_url": {}}, + "interfaces": {} + } +} +``` + #### Register Output Type Register a new output type in the control plane using a YAML definition file. @@ -317,10 +371,22 @@ ftf register-output-type YAML_PATH [OPTIONS] **Notes**: - The YAML file must include `name` and `properties` fields. -- The name should be in the format `@namespace/name`. +- The name should be in the format `@namespace/name` (e.g., `@outputs/database`, `@anuj/sqs`). - You can include a `providers` section in the YAML to specify provider information. - Ensures you're logged in before attempting to register the output type. +**Example YAML**: +```yaml +name: "@anuj/sqs" +properties: + attributes: + queue_arn: + type: string + queue_url: + type: string + interfaces: {} +``` + #### Get Resources List all Terraform resources in the given module directory. From 3ffd1bf43304d5d3c02c8f0b86ebeb387a01076c Mon Sep 17 00:00:00 2001 From: Anuj Hydrabadi Date: Mon, 30 Jun 2025 15:25:14 +0530 Subject: [PATCH 2/2] manual changes --- README.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a24d1f1..82fadcf 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ FTF CLI is a command-line interface (CLI) tool that facilitates module generatio ## Key Features -- **Namespace Support**: Output types support both default (`@outputs`) and custom namespaces (e.g., `@anuj/sqs`) - **Module Generation**: Scaffold Terraform modules with standardized structure - **Variable Management**: Add and manage input variables with type validation - **Output Integration**: Wire registered output types as module inputs @@ -179,7 +178,7 @@ ftf add-input [OPTIONS] /path/to/module - `-n, --name`: (prompt) Name of the input variable to add in facets.yaml and variables.tf. - `-dn, --display-name`: (prompt) Human-readable display name for the input variable. - `-d, --description`: (prompt) Description for the input variable. -- `-o, --output-type`: (prompt) The type of registered output to wire as input. Format: @namespace/name (e.g., @outputs/database, @anuj/sqs). +- `-o, --output-type`: (prompt) The type of registered output to wire as input. Format: @namespace/name (e.g., @outputs/database, @custom/sqs). **Notes**: - Updates facets.yaml required inputs and variables.tf accordingly. @@ -192,7 +191,7 @@ ftf add-input /path/to/module \ --name queue_connection \ --display-name "SQS Queue Connection" \ --description "Configuration for SQS queue" \ - --output-type "@anuj/sqs" + --output-type "@custom/sqs" ``` #### Preview (and Publish) Module @@ -310,7 +309,7 @@ ftf get-output-types [OPTIONS] **Example Output**: ``` Registered output types: -- @anuj/sqs +- @custom/sqs - @outputs/cache - @outputs/database ``` @@ -324,15 +323,15 @@ ftf get-output-type-details [OPTIONS] ``` **Options**: -- `-o, --output-type`: (prompt) The output type to get details for. Format: @namespace/name (e.g., @outputs/vpc, @anuj/sqs). +- `-o, --output-type`: (prompt) The output type to get details for. Format: @namespace/name (e.g., @outputs/vpc, @custom/sqs). - `-p, --profile`: (prompt) Profile to use for authentication (default: "default"). **Example Output**: ``` -=== Output Type Details: @anuj/sqs === +=== Output Type Details: @custom/sqs === Name: sqs -Namespace: @anuj +Namespace: @custom Source: CUSTOM Inferred from Module: true @@ -371,13 +370,13 @@ ftf register-output-type YAML_PATH [OPTIONS] **Notes**: - The YAML file must include `name` and `properties` fields. -- The name should be in the format `@namespace/name` (e.g., `@outputs/database`, `@anuj/sqs`). +- The name should be in the format `@namespace/name` (e.g., `@outputs/database`, `@custom/sqs`). - You can include a `providers` section in the YAML to specify provider information. - Ensures you're logged in before attempting to register the output type. **Example YAML**: ```yaml -name: "@anuj/sqs" +name: "@custom/sqs" properties: attributes: queue_arn: