Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update logs pipeline to separate integration and customer pipelines #332

Merged
merged 10 commits into from
Oct 15, 2019
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 0 additions & 94 deletions datadog/import_datadog_logs_index_test.go

This file was deleted.

42 changes: 5 additions & 37 deletions datadog/import_datadog_logs_pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

const pipelineConfigForImport = `
resource "datadog_logs_pipeline" "test_import" {
resource "datadog_logs_custom_pipeline" "test_import" {
name = "imported pipeline"
is_enabled = false
filter {
Expand Down Expand Up @@ -126,19 +126,7 @@ resource "datadog_logs_pipeline" "test_import" {
}
`

const pipelineorderConfigForImport = `
resource "datadog_logs_pipeline_order" "pipelines" {
name = "pipelines"
pipelines = [
"TOYNsNfjTD6zTXVg8_ej1g",
"VxXfWxegScyjG8mMJwnFIA",
"GGVTp-5PT_O9Xhmsxnsu_w",
"VgZXJneKR2qh2WcfAQi6fA"
]
}
`

func TestAccLogsPipeline_importBasic(t *testing.T) {
func TestAccLogsCustomPipeline_importBasic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Expand All @@ -147,36 +135,16 @@ func TestAccLogsPipeline_importBasic(t *testing.T) {
{
Config: pipelineConfigForImport,
Check: resource.ComposeTestCheckFunc(
testAccCheckPipelineExists("datadog_logs_pipeline.test_import"),
testAccCheckPipelineExists("datadog_logs_custom_pipeline.test_import"),
resource.TestCheckResourceAttr(
"datadog_logs_pipeline.test_import", "name", "imported pipeline"),
"datadog_logs_custom_pipeline.test_import", "name", "imported pipeline"),
),
},
{
ResourceName: "datadog_logs_pipeline.test_import",
ResourceName: "datadog_logs_custom_pipeline.test_import",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccLogsPipelineOrder_importBasic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: pipelineorderConfigForImport,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(
"datadog_logs_pipelineorder.pipelines", "name", "pipelines"),
),
},
{
ResourceName: "datadog_logs_pipelineorder.pipelines",
ImportState: true,
},
},
})
}
3 changes: 2 additions & 1 deletion datadog/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ func Provider() terraform.ResourceProvider {
"datadog_integration_aws": resourceDatadogIntegrationAws(),
"datadog_integration_pagerduty": resourceDatadogIntegrationPagerduty(),
"datadog_integration_pagerduty_service_object": resourceDatadogIntegrationPagerdutySO(),
"datadog_logs_custom_pipeline": resourceDatadogLogsCustomPipeline(),
"datadog_logs_index": resourceDatadogLogsIndex(),
"datadog_logs_index_order": resourceDatadogLogsIndexOrder(),
"datadog_logs_pipeline": resourceDatadogLogsPipeline(),
"datadog_logs_integration_pipeline": resourceDatadogLogsIntegrationPipeline(),
"datadog_logs_pipeline_order": resourceDatadogLogsPipelineOrder(),
"datadog_metric_metadata": resourceDatadogMetricMetadata(),
"datadog_monitor": resourceDatadogMonitor(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ var userAgentParser = &schema.Schema{
},
}

func resourceDatadogLogsPipeline() *schema.Resource {
func resourceDatadogLogsCustomPipeline() *schema.Resource {
return &schema.Resource{
Create: resourceDatadogLogsPipelineCreate,
Update: resourceDatadogLogsPipelineUpdate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

const pipelineConfigForCreation = `
resource "datadog_logs_pipeline" "my_pipeline_test" {
resource "datadog_logs_custom_pipeline" "my_pipeline_test" {
name = "my first pipeline"
is_enabled = true
filter {
Expand Down Expand Up @@ -92,7 +92,7 @@ resource "datadog_logs_pipeline" "my_pipeline_test" {
}
`
const pipelineConfigForUpdate = `
resource "datadog_logs_pipeline" "my_pipeline_test" {
resource "datadog_logs_custom_pipeline" "my_pipeline_test" {
name = "updated pipeline"
is_enabled = false
filter {
Expand Down Expand Up @@ -135,40 +135,40 @@ func TestAccDatadogLogsPipeline_basic(t *testing.T) {
{
Config: pipelineConfigForCreation,
Check: resource.ComposeTestCheckFunc(
testAccCheckPipelineExists("datadog_logs_pipeline.my_pipeline_test"),
testAccCheckPipelineExists("datadog_logs_custom_pipeline.my_pipeline_test"),
resource.TestCheckResourceAttr(
"datadog_logs_pipeline.my_pipeline_test", "name", "my first pipeline"),
"datadog_logs_custom_pipeline.my_pipeline_test", "name", "my first pipeline"),
resource.TestCheckResourceAttr(
"datadog_logs_pipeline.my_pipeline_test", "is_enabled", "true"),
"datadog_logs_custom_pipeline.my_pipeline_test", "is_enabled", "true"),
resource.TestCheckResourceAttr(
"datadog_logs_pipeline.my_pipeline_test", "filter.0.query", "source:redis"),
"datadog_logs_custom_pipeline.my_pipeline_test", "filter.0.query", "source:redis"),
resource.TestCheckResourceAttr(
"datadog_logs_pipeline.my_pipeline_test", "processor.0.date_remapper.0.sources.#", "1"),
"datadog_logs_custom_pipeline.my_pipeline_test", "processor.0.date_remapper.0.sources.#", "1"),
resource.TestCheckResourceAttr(
"datadog_logs_pipeline.my_pipeline_test", "processor.1.arithmetic_processor.0.expression", "(time1-time2)*1000"),
"datadog_logs_custom_pipeline.my_pipeline_test", "processor.1.arithmetic_processor.0.expression", "(time1-time2)*1000"),
resource.TestCheckResourceAttr(
"datadog_logs_pipeline.my_pipeline_test", "processor.2.category_processor.0.category.0.filter.0.query", "@severity: \"-\""),
"datadog_logs_custom_pipeline.my_pipeline_test", "processor.2.category_processor.0.category.0.filter.0.query", "@severity: \"-\""),
resource.TestCheckResourceAttr(
"datadog_logs_pipeline.my_pipeline_test", "processor.3.grok_parser.0.grok.0.match_rules", "rule %{date(\"yyyy-MM-dd HH:mm:ss,SSS\"):timestamp}"),
"datadog_logs_custom_pipeline.my_pipeline_test", "processor.3.grok_parser.0.grok.0.match_rules", "rule %{date(\"yyyy-MM-dd HH:mm:ss,SSS\"):timestamp}"),
resource.TestCheckResourceAttr(
"datadog_logs_pipeline.my_pipeline_test", "processor.4.pipeline.0.filter.0.query", "source:kafka"),
"datadog_logs_custom_pipeline.my_pipeline_test", "processor.4.pipeline.0.filter.0.query", "source:kafka"),
resource.TestCheckResourceAttr(
"datadog_logs_pipeline.my_pipeline_test", "processor.4.pipeline.0.processor.0.url_parser.0.sources.#", "1"),
"datadog_logs_custom_pipeline.my_pipeline_test", "processor.4.pipeline.0.processor.0.url_parser.0.sources.#", "1"),
resource.TestCheckResourceAttr(
"datadog_logs_pipeline.my_pipeline_test", "processor.4.pipeline.0.processor.1.user_agent_parser.0.target", "http_agent.details"),
"datadog_logs_custom_pipeline.my_pipeline_test", "processor.4.pipeline.0.processor.1.user_agent_parser.0.target", "http_agent.details"),
),
}, {
Config: pipelineConfigForUpdate,
Check: resource.ComposeTestCheckFunc(
testAccCheckPipelineExists("datadog_logs_pipeline.my_pipeline_test"),
testAccCheckPipelineExists("datadog_logs_custom_pipeline.my_pipeline_test"),
resource.TestCheckResourceAttr(
"datadog_logs_pipeline.my_pipeline_test", "name", "updated pipeline"),
"datadog_logs_custom_pipeline.my_pipeline_test", "name", "updated pipeline"),
resource.TestCheckResourceAttr(
"datadog_logs_pipeline.my_pipeline_test", "is_enabled", "false"),
"datadog_logs_custom_pipeline.my_pipeline_test", "is_enabled", "false"),
resource.TestCheckResourceAttr(
"datadog_logs_pipeline.my_pipeline_test", "filter.0.query", "source:kafka"),
"datadog_logs_custom_pipeline.my_pipeline_test", "filter.0.query", "source:kafka"),
resource.TestCheckResourceAttr(
"datadog_logs_pipeline.my_pipeline_test", "processor.2.attribute_remapper.0.preserve_source", "true"),
"datadog_logs_custom_pipeline.my_pipeline_test", "processor.2.attribute_remapper.0.preserve_source", "true"),
),
},
},
Expand All @@ -187,7 +187,7 @@ func testAccCheckPipelineExists(name string) resource.TestCheckFunc {

func pipelineExistsChecker(s *terraform.State, client *datadog.Client) error {
for _, r := range s.RootModule().Resources {
if r.Type == "datadog_logs_pipeline" {
if r.Type == "datadog_logs_custom_pipeline" {
id := r.Primary.ID
if _, err := client.GetLogsPipeline(id); err != nil {
return fmt.Errorf("received an error when retrieving pipeline, (%s)", err)
Expand All @@ -207,7 +207,7 @@ func testAccCheckPipelineDestroy(s *terraform.State) error {

func pipelineDestroyHelper(s *terraform.State, client *datadog.Client) error {
for _, r := range s.RootModule().Resources {
if r.Type == "datadog_logs_pipeline" {
if r.Type == "datadog_logs_custom_pipeline" {
id := r.Primary.ID
p, err := client.GetLogsPipeline(id)

Expand Down
82 changes: 0 additions & 82 deletions datadog/resource_datadog_logs_index_order_test.go

This file was deleted.

Loading