Skip to content

Commit decdfaf

Browse files
authored
docs: improvment of import (#395)
Co-authored-by: Christian Lechner <[email protected]>
1 parent 6065b05 commit decdfaf

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

released/import/README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ In a nutshell we will:
1212

1313
We will now walk through this process in detail in the following sections.
1414

15+
> [!NOTE]
16+
> The following description covers the *manual* process of an import using [import blocks](https://developer.hashicorp.com/terraform/language/import). Terraform as well as OpenTofu offer an [experimental feature](https://developer.hashicorp.com/terraform/language/import/generating-configuration) to generate the resource configuration. While this removes the burden of manually crafting the configuration code, manual rework is required to introduce dependencies between resources as well as making the code more reusable via variables or local values.
17+
18+
1519
## Prerequisites
1620

1721
To have resources that need to be imported we first need to create a subaccount and a service entitlement on SAP BTP using the SAP BTP Cockpit.
@@ -203,7 +207,7 @@ terraform plan
203207

204208
The result should display that two resources get imported. No additions, changes or deletions should be planned. The output should look like this:
205209

206-
```bash
210+
```bash
207211
btp_subaccount.my_imported_subaccount: Preparing import... [id=XYZ]
208212
btp_subaccount.my_imported_subaccount: Refreshing state... [id=XYZ]
209213
btp_subaccount_entitlement.my_imported_entitlement: Preparing import... [id=XYZ,alert-notification,standard]
@@ -256,7 +260,7 @@ To execute the import, we run:
256260
terraform apply
257261
```
258262

259-
As a result we see a `terraform.tfstate` file in our filesystem.
263+
As a result we see a `terraform.tfstate` file in our filesystem.
260264

261265
To validate that we have brought the manually created resources under the control of Terraform we execute a `terraform plan` which should state that:
262266

@@ -271,3 +275,6 @@ The import was successful, and you can manage the imported resources via Terrafo
271275
## Additional Information
272276

273277
You find more information about the Teraform import functionality in the [Terraform documentation](https://www.terraform.io/docs/cli/import/index.html).
278+
279+
> [!TIP]
280+
> To simplify the state import, we offer a SAP BTP specific CLI called [Terraform Exporter for SAP BTP](https://sap.github.io/terraform-exporter-btp/). This CLI streamlines the process of the import so that you can e.g., import one subaccount via one single command. For details please check the [documentation](https://sap.github.io/terraform-exporter-btp/).

0 commit comments

Comments
 (0)