Skip to content

Commit 5f2b147

Browse files
authored
PLT-1852: Added import support for all resources (#647)
* PLT-1852: Added import support for all resoruces * Fixed alert import Signed-off-by: Sivaanand Murugesan <[email protected]> * fixed import for application profile * tested cluster group import * fix * refreshed docs * Fixed application import * refresh template * Fixed ippool import * fixed dns map import * tested backup storage location * test oci registry * fixed all resource import --------- Signed-off-by: Sivaanand Murugesan <[email protected]>
1 parent cd2c967 commit 5f2b147

File tree

55 files changed

+1541
-19
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1541
-19
lines changed

docs/resources/appliance.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ resource "spectrocloud_appliance" "appliance" {
2121
}
2222
```
2323

24+
## Import
25+
26+
Appliances can be imported using the appliance UID. This is a project-level resource.
27+
28+
```bash
29+
terraform import spectrocloud_appliance.example <appliance_uid>
30+
```
31+
32+
Where `<appliance_uid>` is the appliance UID.
33+
34+
The import will automatically populate all configuration fields from the Spectro Cloud API, including the UID, tags, and tunnel configuration settings. The `wait` field will be set to `false` by default for imported appliances. After import, you can run `terraform plan` to see the current configuration and make any necessary adjustments.
35+
36+
**Note**: Since this is a project-level resource, ensure your provider is configured with appropriate project-level credentials and access.
37+
38+
2439
<!-- schema generated by tfplugindocs -->
2540
## Schema
2641

docs/resources/application.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ resource "spectrocloud_application" "application" {
3232
3333
```
3434

35+
## Import
36+
37+
Applications can be imported using their UID. The import will automatically detect the cluster context.
38+
39+
```bash
40+
terraform import spectrocloud_application.example 63444eb70807dc2c14a8ad59
41+
```
42+
43+
Note: During import, the application's configuration will be automatically populated from the Spectro Cloud API, including the correct cluster context.
44+
3545

3646
<!-- schema generated by tfplugindocs -->
3747
## Schema

docs/resources/application_profile.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,21 @@ resource "spectrocloud_application_profile" "app_profile_all_tiers" {
349349
350350
```
351351

352+
```
353+
## Import
354+
355+
# terraform import spectrocloud_application_profile.app_profile_all_tiers "profile_uid_here"
356+
#
357+
# Where:
358+
# - profile_uid_here is the unique identifier of the application profile
359+
#
360+
# To import using import block:
361+
# import {
362+
# to = spectrocloud_application_profile.app_profile_all_tiers
363+
# id = "profile_uid_here"
364+
# }
365+
```
366+
352367
<!-- schema generated by tfplugindocs -->
353368
## Schema
354369

docs/resources/backup_storage_location.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,33 @@ resource "spectrocloud_backup_storage_location" "bsl2" {
4444
}
4545
```
4646

47+
## Import
48+
49+
Backup Storage Locations can be imported using either a simple ID format or with explicit context specification. This resource supports both project and tenant contexts.
50+
51+
### Simple Import (defaults to project context)
52+
53+
```bash
54+
terraform import spectrocloud_backup_storage_location.example <bsl_id>:project
55+
```
56+
57+
### Context-specific Import
58+
59+
```bash
60+
terraform import spectrocloud_backup_storage_location.example <bsl_id>:project
61+
terraform import spectrocloud_backup_storage_location.example <bsl_id>:tenant
62+
```
63+
64+
Where:
65+
- `<bsl_id>` is the Backup Storage Location ID
66+
- `project` or `tenant` specifies the context where the backup storage location exists
67+
68+
**Import behavior:**
69+
- If no context is specified, it defaults to `project` context
70+
- If the resource is not found in the specified context, the import will automatically try the other context
71+
- The import will automatically populate all configuration fields from the Spectro Cloud API, including the correct context, storage provider, and all provider-specific settings
72+
73+
After import, you can run `terraform plan` to see the current configuration and make any necessary adjustments.
4774

4875

4976
<!-- schema generated by tfplugindocs -->

docs/resources/cluster_group.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,25 @@ resource "spectrocloud_cluster_group" "cg" {
4040
4141
```
4242

43+
## Import
44+
45+
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import)
46+
to import the resource spectrocloud_cluster_group by using its `id` with the Palette `context` separated by a colon. For example:
47+
48+
```terraform
49+
import {
50+
to = spectrocloud_cluster_group.example
51+
id = "example_id:context"
52+
}
53+
```
54+
55+
Using `terraform import`, import the cluster group using the `id` colon separated with `context`. For example:
56+
57+
```console
58+
terraform import spectrocloud_cluster_group.example example_id:project
59+
```
60+
61+
Refer to the [Import section](/docs#import) to learn more.
4362

4463
<!-- schema generated by tfplugindocs -->
4564
## Schema

docs/resources/privatecloudgateway_dns_map.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,23 @@ An example of creating an DNS Map for a Private Cloud Gateway using a search dom
2727
}
2828
```
2929

30+
## Import
31+
32+
Private Cloud Gateway DNS maps can be imported using the composite ID format: `pcg_id:dns_map_id`. This is a tenant-level resource.
33+
34+
```bash
35+
terraform import spectrocloud_privatecloudgateway_dns_map.example <pcg_id>:<dns_map_id>
36+
```
37+
38+
Where:
39+
- `<pcg_id>` is the Private Cloud Gateway ID
40+
- `<dns_map_id>` is the DNS map ID
41+
42+
The import will automatically populate all configuration fields from the Spectro Cloud API, including the associated Private Cloud Gateway ID, search domain name, data center, and network. After import, you can run `terraform plan` to see the current configuration and make any necessary adjustments.
43+
44+
**Note**: Since this is a tenant-level resource, ensure your provider is configured with appropriate tenant-level credentials and access.
45+
46+
3047
<!-- schema generated by tfplugindocs -->
3148
## Schema
3249

docs/resources/privatecloudgateway_ippool.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,22 @@ An example of creating an IP Pool for a Private Cloud Gateway using a subnet of
5252
}
5353
```
5454

55+
## Import
56+
57+
Private Cloud Gateway IP pools can be imported using the composite ID format: `pcg_id:ippool_id`. This is a tenant-level resource.
58+
59+
```bash
60+
terraform import spectrocloud_privatecloudgateway_ippool.example <pcg_id>:<ippool_id>
61+
```
62+
63+
Where:
64+
- `<pcg_id>` is the Private Cloud Gateway ID
65+
- `<ippool_id>` is the IP Pool ID
66+
67+
The import will automatically populate all configuration fields from the Spectro Cloud API. After import, you can run `terraform plan` to see the current configuration and make any necessary adjustments.
68+
69+
**Note**: Since this is a tenant-level resource, ensure your provider is configured with appropriate tenant-level credentials and access.
70+
5571

5672
<!-- schema generated by tfplugindocs -->
5773
## Schema

docs/resources/registry_helm.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@ resource "spectrocloud_registry_helm" "r1" {
2424
}
2525
```
2626

27+
## Import
28+
29+
Helm registries can be imported using the registry ID. This is a tenant-level resource.
30+
31+
```bash
32+
terraform import spectrocloud_registry_helm.example <registry_id>
33+
```
34+
35+
Where `<registry_id>` is the Helm registry ID.
36+
37+
The import will automatically populate all configuration fields from the Spectro Cloud API, including the name, endpoint, privacy setting, and authentication credentials. After import, you can run `terraform plan` to see the current configuration and make any necessary adjustments.
38+
39+
**Note**: Since this is a tenant-level resource, ensure your provider is configured with appropriate tenant-level credentials and access.
40+
2741

2842
<!-- schema generated by tfplugindocs -->
2943
## Schema

docs/resources/registry_oci.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,20 @@ resource "spectrocloud_registry_oci" "r1" {
2525
}
2626
```
2727

28+
## Import
29+
30+
OCI registries can be imported using the registry ID. This is a tenant-level resource.
31+
32+
```bash
33+
terraform import spectrocloud_registry_oci.example <registry_id>
34+
```
35+
36+
Where `<registry_id>` is the OCI registry ID.
37+
38+
The import will automatically detect whether the registry is an ECR or basic type and populate all configuration fields from the Spectro Cloud API. After import, you can run `terraform plan` to see the current configuration and make any necessary adjustments.
39+
40+
**Note**: Since this is a tenant-level resource, ensure your provider is configured with appropriate tenant-level credentials and access.
41+
2842

2943
<!-- schema generated by tfplugindocs -->
3044
## Schema

docs/resources/ssh_key.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,34 @@ resource "spectrocloud_ssh_key" "primary_key_1" {
5858
}
5959
```
6060

61+
## Import
62+
63+
SSH keys can be imported using either a simple ID format or with explicit context specification. This resource supports both project and tenant contexts.
64+
65+
### Simple Import (defaults to project context)
66+
67+
```bash
68+
terraform import spectrocloud_ssh_key.example <ssh_key_id>
69+
```
70+
71+
### Context-specific Import
72+
73+
```bash
74+
terraform import spectrocloud_ssh_key.example <ssh_key_id>:project
75+
terraform import spectrocloud_ssh_key.example <ssh_key_id>:tenant
76+
```
77+
78+
Where:
79+
- `<ssh_key_id>` is the SSH key ID
80+
- `project` or `tenant` specifies the context where the SSH key exists
81+
82+
**Import behavior:**
83+
- If no context is specified, it defaults to `project` context
84+
- If the resource is not found in the specified context, the import will automatically try the other context
85+
- The import will automatically populate all configuration fields from the Spectro Cloud API, including the correct context, name, and SSH key content
86+
87+
After import, you can run `terraform plan` to see the current configuration and make any necessary adjustments.
88+
6189

6290
<!-- schema generated by tfplugindocs -->
6391
## Schema

0 commit comments

Comments
 (0)