Skip to content

Conversation

@rcv-goku
Copy link

This PR adds comprehensive file copy functionality to the IIS Terraform provider
with improved path resolution and fixes critical provider configuration issues
for multi-server deployments.

🚀 New Features

File Copy Operations

  • Recursive Path Resolution: Implemented comprehensive findFileByPath function that recursively searches the entire file system to locate files by physical path
  • Direct Path Configuration: File copy resources now accept file paths directly instead of requiring pre-resolved IDs
  • Multi-Server Support: File copy operations work seamlessly across multiple IIS server instances

Provider Configuration Improvements

  • Fixed Alias Configuration: Corrected provider alias setup to properly support multiple server instances
  • Subdomain Host Support: Resolved "unsupported protocol scheme" errors when using subdomain hosts
  • Enhanced State Management: Improved resource state handling to prevent "Root object was present, but now absent" errors

Infrastructure Protection

  • System Resource Protection: Added documentation and safeguards for critical IIS resources like DefaultAppPool and Default Web Site
  • Import Block Resilience: Removed dependency on importing existing resources, making configuration more robust
  • Dependency Management: Proper resource dependencies to ensure correct creation/destruction order

🐛 Bug Fixes

  • Fixed findFileByPath function that was incomplete and causing 404 errors
  • Resolved provider configuration issues with aliased providers
  • Fixed file copy resource state management preventing successful resource creation
  • Corrected import blocks referencing non-existent destroyed resources

📝 Technical Changes

  • Added recursive directory traversal with case-insensitive path matching
  • Enhanced error handling with detailed logging for debugging
  • Simplified Terraform configuration by removing complex ID resolution locals
  • Added missing imports (fmt, strings) to provider code

✅ Testing

  • Successfully tested file copy from C:\ProgramData\GuestConfig\Configuration\ProjectPulse\Modules\AdditionalFiles\default.aspx to C:\inetpub\ProjectPulse\
  • Verified multi-server deployment (server1 and server2) functionality
  • Confirmed proper website status handling (Default Web Site stopped, ProjectPulse started)
  • Validated certificate binding and SSL configuration

- Add recursive file path search in findFileByPath function
- Fix iis_file_copy resource to use file paths instead of pre-resolved IDs
- Correct provider alias configuration for multi-server setup
- Remove problematic import blocks for destroyed default resources
- Add protective documentation for system resources
- Fix provider state management in file copy operations
- Resolve "unsupported protocol scheme" errors with subdomain hosts

Fixes issues with file copy operations failing due to incomplete path resolution
and provider configuration problems in multi-server IIS deployments.
Add reusable GitHub Actions workflows for automated IIS deployments and
automatic API token generation from NTLM credentials.

Key features:
- Reusable workflow (apply-iis-config.yml) for CI/CD automation
- Automatic API token generation when only NTLM credentials provided
- Provider auto-generates tokens on initialization (no manual token management)
- Multi-server deployment support via YAML configuration
- Comprehensive documentation with templates and examples

GitHub Actions:
- Build provider from source automatically
- Deploy to multiple IIS servers from any repository
- Support apply/destroy operations with state artifacts
- 8 workflow templates for common scenarios

API Token Auto-Generation:
- Provider automatically generates tokens from NTLM credentials
- No need for manual token creation or iis_api_token resource
- Transparent token refresh on provider initialization
- Backward compatible with explicit access_key configuration

Files added:
- .github/workflows/apply-iis-config.yml (reusable workflow)
- .github/workflows/test-deployment.yml (testing workflow)
- .github/workflows/example-caller.yml (usage examples)
- docs/GITHUB_ACTIONS.md (integration guide)
- docs/WORKFLOW_TEMPLATES.md (8 templates)
- docs/QUICK_START_GITHUB_ACTIONS.md (5-min setup)
- AUTO_TOKEN_GENERATION.md (token auto-generation docs)
- provider/resource_api_token.go (iis_api_token resource)
- iis/api_token.go (token generation implementation)

This enables zero-configuration deployments - just provide NTLM credentials
and the provider handles token generation automatically.
feat: Add GitHub Actions workflows and automatic API token generation
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