Skip to content

feat: Add Terraform import resource name validation (closes #1) - #15

Open
royliz3090-jpg wants to merge 2 commits into
123a-bcd:mainfrom
royliz3090-jpg:terraform-validation
Open

feat: Add Terraform import resource name validation (closes #1)#15
royliz3090-jpg wants to merge 2 commits into
123a-bcd:mainfrom
royliz3090-jpg:terraform-validation

Conversation

@royliz3090-jpg

Copy link
Copy Markdown

Terraform Resource Name Validation

This PR adds validation for Terraform import resource names to prevent state corruption.

Changes:

  • Added validate_resource_name(): Validates individual resource names
  • Added validate_resource_names(): Validates lists of resources
  • Rejects hyphenated names with clear error messages
  • Comprehensive unit tests

Acceptance Criteria:

  • Validate resource names before import
  • Reject hyphenated names with actionable errors
  • Preserve existing behavior for valid names
  • Tests for valid, invalid, and edge cases

Test Results:

test_valid_name ... ok
test_valid_with_underscores ... ok
test_hyphenated_name ... ok
test_name_starting_with_number ... ok
test_empty_name ... ok
test_name_with_spaces ... ok
test_underscore_only ... ok
test_all_valid ... ok
test_mixed_valid_invalid ... ok

Ran 9 tests in 0.001s
OK

Validation Rules:

  • No hyphens (causes Terraform state corruption)
  • Must start with letter or underscore
  • Only alphanumeric characters and underscores

Closes #1


Bounty: $40
Lightning Address: fullphone56@walletofsatoshi.com

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.

[$40 BOUNTY] [Python] Validate Terraform import resource names

1 participant