feat: add import support for domains and aliases#7
feat: add import support for domains and aliases#7crmne wants to merge 2 commits intoforwardemail:mainfrom
Conversation
- Add ImportState support to domain resources using passthrough - Add custom import function for alias resources with "domain/alias" format - Set name field during Read operations to support import state This allows existing ForwardEmail resources to be imported into Terraform: - Domains: terraform import forwardemail_domain.example "example.com" - Aliases: terraform import forwardemail_alias.example "example.com/alias" 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull Request Overview
This PR adds import support for domains and aliases in the ForwardEmail Terraform provider, enabling users to manage existing resources without recreating them.
- Added
ImportStatesupport to domain resources using passthrough context - Added custom import function for alias resources with "domain/alias" format parsing
- Set name field during Read operations to properly support import state
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| forwardemail/resource_forwardemail_domain.go | Adds import support with passthrough context and sets name field in Read operation |
| forwardemail/resource_forwardemail_alias.go | Adds custom import function with domain/alias parsing and sets name field in Read operation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
RoseSecurity
left a comment
There was a problem hiding this comment.
Awesome, thanks again for this contribution. @crmne Would you be able to add an import.sh and import-by-string-id.tf in the examples directory to show how to use this functionality and regenerate the documentation for the registry using: task docs?
Here is a reference
|
I am interested in the import support added by this PR. I almost added such support myself this week. (I opened #9 to start adding such support for the @crmne: I'd like to help getting this PR completed. Are you still working on this PR? |
If you don't get a timely response, feel free to open a new PR with the changes I recommended and we can work to get this merged. |
|
I added the import docs support in this branch on my fork:
|
Would you be able to open a PR for that branch here? |
|
@RoseSecurity: I opened #10 |
Summary
This PR adds import functionality to the ForwardEmail Terraform provider, allowing users to import existing domains and aliases into their Terraform state.
Changes
ImportStatesupport to domain resources using passthrough contextUsage Examples
Import a domain
terraform import forwardemail_domain.example "example.com"Import an alias
Testing
Successfully tested importing:
hello@domain.com)*@domain.com)All imports correctly populated the Terraform state with the proper configuration from the ForwardEmail API.
Motivation
Without import support, users with existing ForwardEmail configurations cannot adopt Terraform management without recreating all their resources, which would cause service disruption.
🤖 Generated with Claude Code