fix: validate Terraform resource names before import (0 bounty) - #14
Open
gaomingyi779-del wants to merge 2 commits into
Open
fix: validate Terraform resource names before import (0 bounty)#14gaomingyi779-del wants to merge 2 commits into
gaomingyi779-del wants to merge 2 commits into
Conversation
fix: validate Terraform resource names before import ($40 bounty) - Add validate_resource_name() that rejects hyphens, dots, uppercase, and other characters unsafe for Terraform resource identifiers. Only [a-z][a-z0-9_]* is permitted. - Validate names during CSV loading (skip invalid rows with clear error) - Validate names in import_resource() before terraform invocation - Add 8 focused tests covering valid names, hyphenated rejection, empty name, uppercase, dots, CSV mixed import, script generation, and invalid-name failure path - Include diagnostic artifacts from build.py Fixes the known issue where hyphenated resource names cause Terraform state corruption by catching them early with a clear error message. Closes 123a-bcd#1 Co-Authored-By: Claude <noreply@anthropic.com> @
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@
Issue
Closes #1 — [$40 BOUNTY] [Python] Validate Terraform import resource names
Changes
Production code (
tools/terraform_import.py)validate_resource_name()— rejects hyphens, dots, uppercase, and other invalid characters. Only[a-z][a-z0-9_]*permitted.import_resource(): invalid names fail before anyterraform importinvocation, preventing state corruption.Tests (
tools/test_terraform_import_validation.py)8 focused tests:
Required artifacts
diagnostic/build-*.logdincludeddiagnostic/build-*.jsonincludedVerification
🤖 Generated with Claude Code
@