Back to Terraform Provider Aws

Adding Resource Import Support

docs/add-import-support.md

6.43.01.8 KB
Original Source
<!-- Copyright IBM Corp. 2014, 2026 --> <!-- SPDX-License-Identifier: MPL-2.0 -->

Adding Resource Import Support

Adding import support for Terraform resources will allow existing infrastructure to be managed within Terraform. This type of enhancement generally requires a small to moderate amount of code changes. Comprehensive code examples and information about resource import support can be found in the Terraform Plugin Framework documentation.

With Resource Identity (Preferred)

By default, adding Resource Identity support to a resource type enables importing. This applies to both Plugin-Framework-based and Plugin-SDK-based resource types.

To enable resource support, see the the Adding Resource Identity Support Guide.

Without Resource Identity

  • Resource Code: In the resource code (e.g., internal/service/{service}/{thing}.go),
  • Resource Acceptance Tests: In the resource acceptance tests (e.g., internal/service/{service}/{thing}_test.go), implement one or more tests containing a TestStep with ImportState: true.
  • Resource Documentation: In the resource documentation (e.g., website/docs/r/service_thing.html.markdown), add an Import section at the bottom of the page.