Skip to content

feat(codegen): Add sensitive variable marking and skip_subcategory support#714

Merged
migara merged 12 commits into
mainfrom
sensitive-vars
Apr 8, 2026
Merged

feat(codegen): Add sensitive variable marking and skip_subcategory support#714
migara merged 12 commits into
mainfrom
sensitive-vars

Conversation

@migara
Copy link
Copy Markdown
Member

@migara migara commented Apr 8, 2026

Description

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

migara and others added 11 commits February 12, 2026 14:49
- Add Subcategory field to TerraformProviderConfig struct for YAML override support
- Add Subcategory field to TerraformProviderSpecMetadata struct
- Implement deriveSubcategoryFromPath() to extract subcategory from spec directory
- Generate individual tfplugindocs templates per resource/data source with subcategory
- Pass subcategory through to terraform provider metadata

Subcategory derivation from directory structure:
- specs/network/ → "Network"
- specs/objects/ → "Objects"
- specs/device/ → "Device"
- specs/panorama/ → "Panorama"
- specs/policies/ → "Policies"

The generated templates in target/terraform/templates/ will have the subcategory
hardcoded, eliminating the need for fix-docs.go post-processing script.
Add scripts/release.sh to automate the PAN-OS release process with three modes:
- --auto: Fully automated (runs codegen, versions, tags, pushes)
- --manual: Interactive (prompts for confirmation, no auto-push)
- --dry-run: Simulation (shows what would be done)

The script handles:
- Running codegen in pan-os-codegen
- Copying generated code to pango and terraform-provider-panos
- Version determination using standard-version (with fallback)
- Creating commits and tags
- Running gofix and terraform doc generation
- Validating subcategories in documentation
- Pushing to remote (in auto mode only)

Uses npx standard-version for conventional commit-based versioning,
with fallback to manual detection if standard-version is unavailable.

Includes comprehensive logging with timestamps and colored output.
- Fix Makefile to use correct config path (cmd/codegen/config.yaml)
- Accumulate flags when same resource has both resource and datasource
- Add debug logging for template generation

This ensures tfplugindocs templates are generated correctly with proper
subcategories for all resources and data sources.
terraform-plugin-docs automatically prepends the provider name when looking
up templates. Template files should be named without the provider prefix:
- Before: panos_address.md.tmpl (looked for panos_panos_address)
- After: address.md.tmpl (correctly looks for panos_address)

This fixes the 'does not exist' error when generating terraform docs.
Resolved conflicts in pkg/translate/terraform_provider/entity_generators.go
by merging the subcategory support from the PR branch with the refactored
code structure from main. The generator.go file was removed as it contained
duplicate declarations now present in entity_generators.go.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add sensitive: true to API key in terraform provider config and to
private-key field in certificate-import spec to ensure these values
are handled securely in generated Terraform code.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- release.yml: GitHub Actions workflow that generates code, runs tests,
  pushes pango SDK, and creates a provider PR with release notes
- determine-version.sh: Detects next version from conventional commits
  with custom release rules (breaking=minor, feat=patch)
- generate-release-notes.sh: Generates markdown release notes grouped
  by commit type

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…gory

Specs can now set `skip_subcategory: true` to explicitly opt out of
subcategory validation. This produces docs with an empty subcategory
and records the resource in a .subcategory-skip file that CI uses to
exclude them from validation. Missing subcategory without the flag
is now an error.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts:
#	pkg/commands/codegen/codegen.go
#	pkg/properties/normalized.go
@migara migara changed the title Sensitive vars feat(codegen): Add sensitive variable marking and skip_subcategory support Apr 8, 2026
The ethernet interface resources referenced panos_template.template
but the template resource is named "tmpl".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@migara migara merged commit e40d72b into main Apr 8, 2026
2 of 3 checks passed
@migara migara deleted the sensitive-vars branch April 8, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant