From 4a9741e8d3fa12386f65d3c68fa04714f9b8a202 Mon Sep 17 00:00:00 2001 From: Darren Murray Date: Tue, 8 Nov 2022 17:31:24 +0000 Subject: [PATCH] refactor: remove last usages of v1 api Signed-off-by: Darren Murray --- lacework/cloud_account_importer.go | 27 ++++++++++++ lacework/container_registry_importer.go | 29 +++++++++++++ lacework/integration_importer.go | 41 ------------------- .../resource_lacework_agent_access_token.go | 16 ++++---- ...e_lacework_alert_channel_aws_cloudwatch.go | 2 +- .../resource_lacework_alert_channel_aws_s3.go | 2 +- ...urce_lacework_alert_channel_cisco_webex.go | 2 +- ...resource_lacework_alert_channel_datadog.go | 2 +- .../resource_lacework_alert_channel_email.go | 2 +- .../resource_lacework_alert_channel_slack.go | 2 +- ...source_lacework_alert_channel_victorops.go | 2 +- ...resource_lacework_alert_channel_webhook.go | 2 +- ...work_integration_aws_agentless_scanning.go | 2 +- .../resource_lacework_integration_aws_cfg.go | 2 +- .../resource_lacework_integration_aws_ct.go | 2 +- ..._lacework_integration_aws_eks_audit_log.go | 2 +- ...e_lacework_integration_aws_govcloud_cfg.go | 2 +- ...ce_lacework_integration_aws_govcloud_ct.go | 2 +- ..._integration_aws_org_agentless_scanning.go | 2 +- .../resource_lacework_integration_azure_al.go | 2 +- ...resource_lacework_integration_azure_cfg.go | 2 +- ...esource_lacework_integration_docker_hub.go | 2 +- ...resource_lacework_integration_docker_v2.go | 4 +- lacework/resource_lacework_integration_ecr.go | 4 +- lacework/resource_lacework_integration_gar.go | 2 +- .../resource_lacework_integration_gcp_at.go | 2 +- .../resource_lacework_integration_gcp_cfg.go | 2 +- ..._lacework_integration_gcp_gke_audit_log.go | 2 +- lacework/resource_lacework_integration_gcr.go | 2 +- .../resource_lacework_integration_ghcr.go | 2 +- 30 files changed, 91 insertions(+), 78 deletions(-) create mode 100644 lacework/cloud_account_importer.go create mode 100644 lacework/container_registry_importer.go delete mode 100644 lacework/integration_importer.go diff --git a/lacework/cloud_account_importer.go b/lacework/cloud_account_importer.go new file mode 100644 index 00000000..f032eadf --- /dev/null +++ b/lacework/cloud_account_importer.go @@ -0,0 +1,27 @@ +package lacework + +import ( + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/lacework/go-sdk/api" +) + +func importLaceworkCloudAccount(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { + lacework := meta.(*api.Client) + var response api.CloudAccountResponse + + log.Printf("[INFO] Importing Lacework Cloud Account with guid: %s\n", d.Id()) + err := lacework.V2.CloudAccounts.Get(d.Id(), &response) + if err != nil { + return nil, err + } + + if response.Data.IntgGuid == d.Id() { + log.Printf("[INFO] Cloud Account integration found using APIv2 with guid: %v\n", response.Data.IntgGuid) + return []*schema.ResourceData{d}, nil + } + + log.Printf("[INFO] Raw APIv2 Cloud Account response: %v\n", response) + return []*schema.ResourceData{d}, nil +} diff --git a/lacework/container_registry_importer.go b/lacework/container_registry_importer.go new file mode 100644 index 00000000..96d9229d --- /dev/null +++ b/lacework/container_registry_importer.go @@ -0,0 +1,29 @@ +package lacework + +import ( + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/lacework/go-sdk/api" +) + +func importLaceworkContainerRegistry(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { + lacework := meta.(*api.Client) + var response api.ContainerRegistryResponse + + log.Printf("[INFO] Importing Lacework Container Registry with guid: %s\n", d.Id()) + err := lacework.V2.CloudAccounts.Get(d.Id(), &response) + if err != nil { + return nil, err + } + + if response.Data.IntgGuid == d.Id() { + log.Printf("[INFO] Container Registry found using APIv2 with guid: %v\n", response.Data.IntgGuid) + return []*schema.ResourceData{d}, nil + } + + log.Printf("[INFO] Raw APIv2 Container Registry response: %v\n", response) + + return []*schema.ResourceData{d}, nil +} diff --git a/lacework/integration_importer.go b/lacework/integration_importer.go deleted file mode 100644 index 83aae0d0..00000000 --- a/lacework/integration_importer.go +++ /dev/null @@ -1,41 +0,0 @@ -package lacework - -import ( - "fmt" - "log" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - - "github.com/lacework/go-sdk/api" -) - -func importLaceworkIntegration(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - lacework := meta.(*api.Client) - - log.Printf("[INFO] Importing Lacework integration with guid: %s\n", d.Id()) - response, err := lacework.Integrations.Get(d.Id()) - if err != nil { - return nil, err - } - - for _, integration := range response.Data { - if integration.IntgGuid == d.Id() { - log.Printf("[INFO] Integration found with guid: %v\n", integration.IntgGuid) - return []*schema.ResourceData{d}, nil - } - } - - log.Printf("[INFO] Raw APIv1 integration response: %v\n", response) - - log.Println("[WARN] Trying APIv2") - var cloudAccount api.CloudAccountRaw - if err := lacework.V2.CloudAccounts.Get(d.Id(), &cloudAccount); err != nil { - return nil, fmt.Errorf( - "Unable to import Lacework resource. Integration with guid '%s' was not found.", - d.Id(), - ) - } - log.Printf("[INFO] Cloud account integration found using APIv2 with guid: %v\n", cloudAccount.IntgGuid) - return []*schema.ResourceData{d}, nil - -} diff --git a/lacework/resource_lacework_agent_access_token.go b/lacework/resource_lacework_agent_access_token.go index a2fd84dd..deaac64d 100644 --- a/lacework/resource_lacework_agent_access_token.go +++ b/lacework/resource_lacework_agent_access_token.go @@ -184,21 +184,19 @@ func importLaceworkAgentAccessToken(d *schema.ResourceData, meta interface{}) ([ lacework := meta.(*api.Client) log.Printf("[INFO] Importing agent access token.") - response, err := lacework.Agents.GetToken(d.Id()) + response, err := lacework.V2.AgentAccessTokens.Get(d.Id()) if err != nil { return nil, err } - for _, token := range response.Data { - if token.AccessToken == d.Id() { - log.Printf("[INFO] agent access token found. name=%s, description=%s, enabled=%t", - token.TokenAlias, token.Props.Description, token.Status()) + if response.Data.AccessToken == d.Id() { + log.Printf("[INFO] agent access token found. name=%s, description=%s, enabled=%t", + response.Data.TokenAlias, response.Data.Props.Description, response.Data.State()) - d.Set("token", token.AccessToken) - d.SetId(token.TokenAlias) + d.Set("token", response.Data.AccessToken) + d.SetId(response.Data.TokenAlias) - return []*schema.ResourceData{d}, nil - } + return []*schema.ResourceData{d}, nil } log.Printf("[INFO] Raw response: %v\n", response) diff --git a/lacework/resource_lacework_alert_channel_aws_cloudwatch.go b/lacework/resource_lacework_alert_channel_aws_cloudwatch.go index e4b218af..fc485554 100644 --- a/lacework/resource_lacework_alert_channel_aws_cloudwatch.go +++ b/lacework/resource_lacework_alert_channel_aws_cloudwatch.go @@ -17,7 +17,7 @@ func resourceLaceworkAlertChannelAwsCloudWatch() *schema.Resource { Delete: resourceLaceworkAlertChannelAwsCloudWatchDelete, Importer: &schema.ResourceImporter{ - State: importLaceworkIntegration, + State: importLaceworkAlertChannel, }, Schema: map[string]*schema.Schema{ diff --git a/lacework/resource_lacework_alert_channel_aws_s3.go b/lacework/resource_lacework_alert_channel_aws_s3.go index 9bfd40e1..1aecd2d2 100644 --- a/lacework/resource_lacework_alert_channel_aws_s3.go +++ b/lacework/resource_lacework_alert_channel_aws_s3.go @@ -16,7 +16,7 @@ func resourceLaceworkAlertChannelAwsS3() *schema.Resource { Delete: resourceLaceworkAlertChannelAwsS3Delete, Importer: &schema.ResourceImporter{ - State: importLaceworkIntegration, + State: importLaceworkAlertChannel, }, Schema: map[string]*schema.Schema{ "name": { diff --git a/lacework/resource_lacework_alert_channel_cisco_webex.go b/lacework/resource_lacework_alert_channel_cisco_webex.go index 814eff6c..6736af3a 100644 --- a/lacework/resource_lacework_alert_channel_cisco_webex.go +++ b/lacework/resource_lacework_alert_channel_cisco_webex.go @@ -15,7 +15,7 @@ func resourceLaceworkAlertChannelCiscoWebex() *schema.Resource { Delete: resourceLaceworkAlertChannelCiscoWebexDelete, Importer: &schema.ResourceImporter{ - State: importLaceworkIntegration, + State: importLaceworkAlertChannel, }, Schema: map[string]*schema.Schema{ diff --git a/lacework/resource_lacework_alert_channel_datadog.go b/lacework/resource_lacework_alert_channel_datadog.go index 1ef1d5bd..d52d19f4 100644 --- a/lacework/resource_lacework_alert_channel_datadog.go +++ b/lacework/resource_lacework_alert_channel_datadog.go @@ -16,7 +16,7 @@ func resourceLaceworkAlertChannelDatadog() *schema.Resource { Delete: resourceLaceworkAlertChannelDatadogDelete, Importer: &schema.ResourceImporter{ - State: importLaceworkIntegration, + State: importLaceworkAlertChannel, }, Schema: map[string]*schema.Schema{ diff --git a/lacework/resource_lacework_alert_channel_email.go b/lacework/resource_lacework_alert_channel_email.go index 4f504c2c..6306a5a4 100644 --- a/lacework/resource_lacework_alert_channel_email.go +++ b/lacework/resource_lacework_alert_channel_email.go @@ -17,7 +17,7 @@ func resourceLaceworkAlertChannelEmail() *schema.Resource { Delete: resourceLaceworkAlertChannelEmailDelete, Importer: &schema.ResourceImporter{ - State: importLaceworkIntegration, + State: importLaceworkAlertChannel, }, Schema: map[string]*schema.Schema{ diff --git a/lacework/resource_lacework_alert_channel_slack.go b/lacework/resource_lacework_alert_channel_slack.go index edb22365..569f6927 100644 --- a/lacework/resource_lacework_alert_channel_slack.go +++ b/lacework/resource_lacework_alert_channel_slack.go @@ -16,7 +16,7 @@ func resourceLaceworkAlertChannelSlack() *schema.Resource { Delete: resourceLaceworkAlertChannelSlackDelete, Importer: &schema.ResourceImporter{ - State: importLaceworkIntegration, + State: importLaceworkAlertChannel, }, Schema: map[string]*schema.Schema{ diff --git a/lacework/resource_lacework_alert_channel_victorops.go b/lacework/resource_lacework_alert_channel_victorops.go index d10b9bfc..8252fb7d 100644 --- a/lacework/resource_lacework_alert_channel_victorops.go +++ b/lacework/resource_lacework_alert_channel_victorops.go @@ -15,7 +15,7 @@ func resourceLaceworkAlertChannelVictorOps() *schema.Resource { Delete: resourceLaceworkAlertChannelVictorOpsDelete, Importer: &schema.ResourceImporter{ - State: importLaceworkIntegration, + State: importLaceworkAlertChannel, }, Schema: map[string]*schema.Schema{ diff --git a/lacework/resource_lacework_alert_channel_webhook.go b/lacework/resource_lacework_alert_channel_webhook.go index 8c4c9e8f..a3c12152 100644 --- a/lacework/resource_lacework_alert_channel_webhook.go +++ b/lacework/resource_lacework_alert_channel_webhook.go @@ -15,7 +15,7 @@ func resourceLaceworkAlertChannelWebhook() *schema.Resource { Delete: resourceLaceworkAlertChannelWebhookDelete, Importer: &schema.ResourceImporter{ - State: importLaceworkIntegration, + State: importLaceworkAlertChannel, }, Schema: map[string]*schema.Schema{ diff --git a/lacework/resource_lacework_integration_aws_agentless_scanning.go b/lacework/resource_lacework_integration_aws_agentless_scanning.go index 5a14526f..7312fbaf 100644 --- a/lacework/resource_lacework_integration_aws_agentless_scanning.go +++ b/lacework/resource_lacework_integration_aws_agentless_scanning.go @@ -18,7 +18,7 @@ func resourceLaceworkIntegrationAwsAgentlessScanning() *schema.Resource { Update: resourceLaceworkIntegrationAwsAgentlessScanningUpdate, Delete: resourceLaceworkIntegrationAwsAgentlessScanningDelete, Schema: awsAgentlessScanningIntegrationSchema, - Importer: &schema.ResourceImporter{State: importLaceworkIntegration}, + Importer: &schema.ResourceImporter{State: importLaceworkCloudAccount}, } } diff --git a/lacework/resource_lacework_integration_aws_cfg.go b/lacework/resource_lacework_integration_aws_cfg.go index 36380b94..42cd77eb 100644 --- a/lacework/resource_lacework_integration_aws_cfg.go +++ b/lacework/resource_lacework_integration_aws_cfg.go @@ -19,7 +19,7 @@ func resourceLaceworkIntegrationAwsCfg() *schema.Resource { Delete: resourceLaceworkIntegrationAwsCfgDelete, Importer: &schema.ResourceImporter{ - State: importLaceworkIntegration, + State: importLaceworkCloudAccount, }, Schema: map[string]*schema.Schema{ diff --git a/lacework/resource_lacework_integration_aws_ct.go b/lacework/resource_lacework_integration_aws_ct.go index 9d9ea314..5f851284 100644 --- a/lacework/resource_lacework_integration_aws_ct.go +++ b/lacework/resource_lacework_integration_aws_ct.go @@ -19,7 +19,7 @@ func resourceLaceworkIntegrationAwsCloudTrail() *schema.Resource { Update: resourceLaceworkIntegrationAwsCloudTrailUpdate, Delete: resourceLaceworkIntegrationAwsCloudTrailDelete, Schema: awsCloudTrailIntegrationSchema, - Importer: &schema.ResourceImporter{State: importLaceworkIntegration}, + Importer: &schema.ResourceImporter{State: importLaceworkCloudAccount}, } } diff --git a/lacework/resource_lacework_integration_aws_eks_audit_log.go b/lacework/resource_lacework_integration_aws_eks_audit_log.go index f03e9cf0..8e0008d5 100644 --- a/lacework/resource_lacework_integration_aws_eks_audit_log.go +++ b/lacework/resource_lacework_integration_aws_eks_audit_log.go @@ -18,7 +18,7 @@ func resourceLaceworkIntegrationAwsEksAuditLog() *schema.Resource { Update: resourceLaceworkIntegrationAwsEksAuditLogUpdate, Delete: resourceLaceworkIntegrationAwsEksAuditLogDelete, Schema: awsEksAuditLogIntegrationSchema, - Importer: &schema.ResourceImporter{State: importLaceworkIntegration}, + Importer: &schema.ResourceImporter{State: importLaceworkCloudAccount}, } } diff --git a/lacework/resource_lacework_integration_aws_govcloud_cfg.go b/lacework/resource_lacework_integration_aws_govcloud_cfg.go index 294e463a..8e37b1fa 100644 --- a/lacework/resource_lacework_integration_aws_govcloud_cfg.go +++ b/lacework/resource_lacework_integration_aws_govcloud_cfg.go @@ -19,7 +19,7 @@ func resourceLaceworkIntegrationAwsGovCloudCfg() *schema.Resource { Delete: resourceLaceworkIntegrationAwsGovCloudCfgDelete, Importer: &schema.ResourceImporter{ - State: importLaceworkIntegration, + State: importLaceworkCloudAccount, }, Schema: map[string]*schema.Schema{ diff --git a/lacework/resource_lacework_integration_aws_govcloud_ct.go b/lacework/resource_lacework_integration_aws_govcloud_ct.go index bf1792bd..58dd6e0b 100644 --- a/lacework/resource_lacework_integration_aws_govcloud_ct.go +++ b/lacework/resource_lacework_integration_aws_govcloud_ct.go @@ -19,7 +19,7 @@ func resourceLaceworkIntegrationAwsGovCloudCT() *schema.Resource { Delete: resourceLaceworkIntegrationAwsGovCloudCTDelete, Importer: &schema.ResourceImporter{ - State: importLaceworkIntegration, + State: importLaceworkCloudAccount, }, Schema: map[string]*schema.Schema{ diff --git a/lacework/resource_lacework_integration_aws_org_agentless_scanning.go b/lacework/resource_lacework_integration_aws_org_agentless_scanning.go index 5f51f921..2673d94a 100644 --- a/lacework/resource_lacework_integration_aws_org_agentless_scanning.go +++ b/lacework/resource_lacework_integration_aws_org_agentless_scanning.go @@ -19,7 +19,7 @@ func resourceLaceworkIntegrationAwsOrgAgentlessScanning() *schema.Resource { Update: resourceLaceworkIntegrationAwsOrgAgentlessScanningUpdate, Delete: resourceLaceworkIntegrationAwsOrgAgentlessScanningDelete, Schema: awsOrgAgentlessScanningIntegrationSchema, - Importer: &schema.ResourceImporter{State: importLaceworkIntegration}, + Importer: &schema.ResourceImporter{State: importLaceworkCloudAccount}, } } diff --git a/lacework/resource_lacework_integration_azure_al.go b/lacework/resource_lacework_integration_azure_al.go index acb6fd5e..49e3635a 100644 --- a/lacework/resource_lacework_integration_azure_al.go +++ b/lacework/resource_lacework_integration_azure_al.go @@ -19,7 +19,7 @@ func resourceLaceworkIntegrationAzureActivityLog() *schema.Resource { Delete: resourceLaceworkIntegrationAzureActivityLogDelete, Importer: &schema.ResourceImporter{ - State: importLaceworkIntegration, + State: importLaceworkCloudAccount, }, Schema: map[string]*schema.Schema{ diff --git a/lacework/resource_lacework_integration_azure_cfg.go b/lacework/resource_lacework_integration_azure_cfg.go index fe631d22..cb6f63f7 100644 --- a/lacework/resource_lacework_integration_azure_cfg.go +++ b/lacework/resource_lacework_integration_azure_cfg.go @@ -19,7 +19,7 @@ func resourceLaceworkIntegrationAzureCfg() *schema.Resource { Delete: resourceLaceworkIntegrationAzureCfgDelete, Importer: &schema.ResourceImporter{ - State: importLaceworkIntegration, + State: importLaceworkCloudAccount, }, Schema: map[string]*schema.Schema{ diff --git a/lacework/resource_lacework_integration_docker_hub.go b/lacework/resource_lacework_integration_docker_hub.go index 774e0ca3..4fddfa61 100644 --- a/lacework/resource_lacework_integration_docker_hub.go +++ b/lacework/resource_lacework_integration_docker_hub.go @@ -17,7 +17,7 @@ func resourceLaceworkIntegrationDockerHub() *schema.Resource { Delete: resourceLaceworkIntegrationDockerHubDelete, Importer: &schema.ResourceImporter{ - State: importLaceworkIntegration, + State: importLaceworkContainerRegistry, }, Schema: map[string]*schema.Schema{ diff --git a/lacework/resource_lacework_integration_docker_v2.go b/lacework/resource_lacework_integration_docker_v2.go index 74bf515d..97e51d75 100644 --- a/lacework/resource_lacework_integration_docker_v2.go +++ b/lacework/resource_lacework_integration_docker_v2.go @@ -17,7 +17,7 @@ func resourceLaceworkIntegrationDockerV2() *schema.Resource { Delete: resourceLaceworkIntegrationDockerV2Delete, Importer: &schema.ResourceImporter{ - State: importLaceworkIntegration, + State: importLaceworkContainerRegistry, }, Schema: map[string]*schema.Schema{ @@ -240,7 +240,7 @@ func resourceLaceworkIntegrationDockerV2Delete(d *schema.ResourceData, meta inte log.Printf("[INFO] Deleting %s registry type with guid: %v\n", api.DockerhubV2ContainerRegistry.String(), d.Id()) - _, err := lacework.Integrations.Delete(d.Id()) + err := lacework.V2.ContainerRegistries.Delete(d.Id()) if err != nil { return err } diff --git a/lacework/resource_lacework_integration_ecr.go b/lacework/resource_lacework_integration_ecr.go index 41bd9780..1be388e0 100644 --- a/lacework/resource_lacework_integration_ecr.go +++ b/lacework/resource_lacework_integration_ecr.go @@ -258,7 +258,7 @@ func resourceLaceworkIntegrationEcrUpdate(d *schema.ResourceData, meta interface log.Println("[WARN] Change of authentication method detected. Need destroy and recreation") log.Printf("[INFO] Deleting %s integration %s registry type with guid: %v\n", api.ContainerRegistryIntegration.String(), api.EcrRegistry.String(), d.Id()) - _, err := lacework.Integrations.Delete(d.Id()) + err := lacework.V2.ContainerRegistries.Delete(d.Id()) if err != nil { return err } @@ -284,7 +284,7 @@ func resourceLaceworkIntegrationEcrUpdate(d *schema.ResourceData, meta interface log.Println("[WARN] Change of authentication method detected. Need destroy and recreation") log.Printf("[INFO] Deleting %s integration %s registry type with guid: %v\n", api.ContainerRegistryIntegration.String(), api.EcrRegistry.String(), d.Id()) - _, err := lacework.Integrations.Delete(d.Id()) + err := lacework.V2.ContainerRegistries.Delete(d.Id()) if err != nil { return err } diff --git a/lacework/resource_lacework_integration_gar.go b/lacework/resource_lacework_integration_gar.go index 07dd0d71..8673306f 100644 --- a/lacework/resource_lacework_integration_gar.go +++ b/lacework/resource_lacework_integration_gar.go @@ -48,7 +48,7 @@ func resourceLaceworkIntegrationGar() *schema.Resource { Delete: resourceLaceworkIntegrationGarDelete, Importer: &schema.ResourceImporter{ - State: importLaceworkIntegration, + State: importLaceworkContainerRegistry, }, Schema: map[string]*schema.Schema{ diff --git a/lacework/resource_lacework_integration_gcp_at.go b/lacework/resource_lacework_integration_gcp_at.go index 98251998..fb17690a 100644 --- a/lacework/resource_lacework_integration_gcp_at.go +++ b/lacework/resource_lacework_integration_gcp_at.go @@ -20,7 +20,7 @@ func resourceLaceworkIntegrationGcpAt() *schema.Resource { Delete: resourceLaceworkIntegrationGcpAtDelete, Importer: &schema.ResourceImporter{ - State: importLaceworkIntegration, + State: importLaceworkCloudAccount, }, Schema: map[string]*schema.Schema{ diff --git a/lacework/resource_lacework_integration_gcp_cfg.go b/lacework/resource_lacework_integration_gcp_cfg.go index 01af7d6c..cbd6a502 100644 --- a/lacework/resource_lacework_integration_gcp_cfg.go +++ b/lacework/resource_lacework_integration_gcp_cfg.go @@ -20,7 +20,7 @@ func resourceLaceworkIntegrationGcpCfg() *schema.Resource { Delete: resourceLaceworkIntegrationGcpCfgDelete, Importer: &schema.ResourceImporter{ - State: importLaceworkIntegration, + State: importLaceworkCloudAccount, }, Schema: map[string]*schema.Schema{ diff --git a/lacework/resource_lacework_integration_gcp_gke_audit_log.go b/lacework/resource_lacework_integration_gcp_gke_audit_log.go index 47d84903..0859e14c 100644 --- a/lacework/resource_lacework_integration_gcp_gke_audit_log.go +++ b/lacework/resource_lacework_integration_gcp_gke_audit_log.go @@ -19,7 +19,7 @@ func resourceLaceworkIntegrationGcpGkeAuditLog() *schema.Resource { Update: resourceLaceworkIntegrationGcpGkeAuditLogUpdate, Delete: resourceLaceworkIntegrationGcpGkeAuditLogDelete, Schema: gcpGkeAuditLogIntegrationSchema, - Importer: &schema.ResourceImporter{State: importLaceworkIntegration}, + Importer: &schema.ResourceImporter{State: importLaceworkCloudAccount}, } } diff --git a/lacework/resource_lacework_integration_gcr.go b/lacework/resource_lacework_integration_gcr.go index 24b5fc05..773c3cb4 100644 --- a/lacework/resource_lacework_integration_gcr.go +++ b/lacework/resource_lacework_integration_gcr.go @@ -18,7 +18,7 @@ func resourceLaceworkIntegrationGcr() *schema.Resource { Delete: resourceLaceworkIntegrationGcrDelete, Importer: &schema.ResourceImporter{ - State: importLaceworkIntegration, + State: importLaceworkContainerRegistry, }, Schema: map[string]*schema.Schema{ diff --git a/lacework/resource_lacework_integration_ghcr.go b/lacework/resource_lacework_integration_ghcr.go index cab28f1c..04f36aa0 100644 --- a/lacework/resource_lacework_integration_ghcr.go +++ b/lacework/resource_lacework_integration_ghcr.go @@ -17,7 +17,7 @@ func resourceLaceworkIntegrationGhcr() *schema.Resource { Delete: resourceLaceworkIntegrationGhcrDelete, Importer: &schema.ResourceImporter{ - State: importLaceworkIntegration, + State: importLaceworkContainerRegistry, }, Schema: map[string]*schema.Schema{