From e298080d790fad3a25102ae3f655891abaa133fb Mon Sep 17 00:00:00 2001 From: Wilson de Carvalho <796900+wcmjunior@users.noreply.github.com> Date: Thu, 25 Jan 2024 18:59:31 -0800 Subject: [PATCH] Update CFT template data source info and disable tests (#500) --- .../data_source_cyral_sidecar_cft_template.go | 2 +- ..._source_cyral_sidecar_cft_template_test.go | 85 ------------------- docs/data-sources/sidecar_cft_template.md | 2 +- 3 files changed, 2 insertions(+), 87 deletions(-) delete mode 100644 cyral/internal/deprecated/data_source_cyral_sidecar_cft_template_test.go diff --git a/cyral/internal/deprecated/data_source_cyral_sidecar_cft_template.go b/cyral/internal/deprecated/data_source_cyral_sidecar_cft_template.go index 25b082a2..dd6792ff 100644 --- a/cyral/internal/deprecated/data_source_cyral_sidecar_cft_template.go +++ b/cyral/internal/deprecated/data_source_cyral_sidecar_cft_template.go @@ -20,7 +20,7 @@ const CloudFormationDeploymentMethod = "cft-ec2" func DataSourceSidecarCftTemplate() *schema.Resource { return &schema.Resource{ DeprecationMessage: "This data source was deprecated. It will be removed in the next major version of " + - "the provider.", + "the provider and no longer works for control planes `v4.13` and later.", Description: "Retrieves the CloudFormation deployment template for a given sidecar. This data source only " + "supports sidecars with `cft-ec2` deployment method. For Terraform template, use our " + "`terraform-cyral-sidecar-aws` module.", diff --git a/cyral/internal/deprecated/data_source_cyral_sidecar_cft_template_test.go b/cyral/internal/deprecated/data_source_cyral_sidecar_cft_template_test.go deleted file mode 100644 index 9917fb59..00000000 --- a/cyral/internal/deprecated/data_source_cyral_sidecar_cft_template_test.go +++ /dev/null @@ -1,85 +0,0 @@ -package deprecated_test - -import ( - "fmt" - "regexp" - "testing" - - "github.com/cyralinc/terraform-provider-cyral/cyral/provider" - "github.com/cyralinc/terraform-provider-cyral/cyral/utils" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -const ( - sidecarCftTemplateDataSourceName = "data-sidecar-cft-template" -) - -func TestAccSidecarCftTemplateDataSource(t *testing.T) { - cftConfig, cftFunc := setupSidecarCftTemplateTest() - - resource.ParallelTest( - t, resource.TestCase{ - ProviderFactories: provider.ProviderFactories, - Steps: []resource.TestStep{ - { - Config: cftConfig, - Check: cftFunc, - }, - }, - }, - ) -} - -func setupSidecarCftTemplateTest() (string, resource.TestCheckFunc) { - var configuration string - configuration += utils.FormatBasicSidecarIntoConfig( - utils.BasicSidecarResName, - utils.AccTestName(sidecarCftTemplateDataSourceName, "sidecar"), - "cft-ec2", "", - ) - configuration += utils.FormatELKIntegrationDataIntoConfig( - utils.AccTestName(sidecarCftTemplateDataSourceName, "elk"), - "kibana.local", - "es.local", - ) - configuration += utils.FormatDatadogIntegrationDataIntoConfig( - utils.AccTestName(sidecarCftTemplateDataSourceName, "datadog"), - "datadog-api-key", - ) - configuration += formatSidecarCftTemplateDataIntoConfig( - utils.BasicSidecarID, - "cyral_integration_elk.elk_integration.id", - "cyral_integration_datadog.datadog_integration.id", - true, - "ec2-key-name", - ) - - testFunction := resource.ComposeTestCheckFunc( - resource.TestMatchOutput("output_template", regexp.MustCompile(`\w+`)), - ) - - return configuration, testFunction -} - -func formatSidecarCftTemplateDataIntoConfig( - sidecarID, logIntegrationID, metricsIntegrationID string, - publiclyAccessible bool, - keyName string, -) string { - return fmt.Sprintf( - ` - data "cyral_sidecar_cft_template" "test_template" { - sidecar_id = %s - log_integration_id = %s - metrics_integration_id = %s - aws_configuration { - publicly_accessible = %t - key_name = "%s" - } - } - output "output_template" { - value = data.cyral_sidecar_cft_template.test_template.template - }`, sidecarID, logIntegrationID, metricsIntegrationID, publiclyAccessible, - keyName, - ) -} diff --git a/docs/data-sources/sidecar_cft_template.md b/docs/data-sources/sidecar_cft_template.md index 206440ed..03169d95 100644 --- a/docs/data-sources/sidecar_cft_template.md +++ b/docs/data-sources/sidecar_cft_template.md @@ -1,6 +1,6 @@ # cyral_sidecar_cft_template (Data Source) -~> **DEPRECATED** This data source was deprecated. It will be removed in the next major version of the provider. +~> **DEPRECATED** This data source was deprecated. It will be removed in the next major version of the provider and no longer works for control planes `v4.13` and later. ## Example Usage