Skip to content

Commit

Permalink
[PIPE-22716] Fixed execution pipeline filter creation for service_ide… (
Browse files Browse the repository at this point in the history
#1104)

* [PIPE-22716] Fixed execution pipeline filter creation for service_identifier tag

* Added documentation and examples
  • Loading branch information
shashankJainHarness authored Oct 25, 2024
1 parent 0fd83b9 commit aca2822
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changelog/1090.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```release-note:fix
harness_platform_pipeline_filters: added service_identifiers to fix service level filtering for pipeline execution filters. lifecycle.

Added example for execution pipeline filter with service_identifiers.
```
9 changes: 5 additions & 4 deletions docs/data-sources/platform_pipeline_filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Read-Only:
- `artifact_display_names` (Set of String)
- `deployment_types` (String)
- `environment_names` (Set of String)
- `service_identifiers` (Set of String)
- `service_names` (Set of String)


Expand All @@ -76,15 +77,15 @@ Read-Only:
- `tag` (String)

<a id="nestedobjatt--filter_properties--module_properties--ci--ci_execution_info"></a>
### Nested Schema for `filter_properties.module_properties.ci.tag`
### Nested Schema for `filter_properties.module_properties.ci.ci_execution_info`

Read-Only:

- `event` (String)
- `pull_request` (List of Object) (see [below for nested schema](#nestedobjatt--filter_properties--module_properties--ci--tag--pull_request))
- `pull_request` (List of Object) (see [below for nested schema](#nestedobjatt--filter_properties--module_properties--ci--ci_execution_info--pull_request))

<a id="nestedobjatt--filter_properties--module_properties--ci--tag--pull_request"></a>
### Nested Schema for `filter_properties.module_properties.ci.tag.pull_request`
<a id="nestedobjatt--filter_properties--module_properties--ci--ci_execution_info--pull_request"></a>
### Nested Schema for `filter_properties.module_properties.ci.ci_execution_info.pull_request`

Read-Only:

Expand Down
25 changes: 24 additions & 1 deletion examples/resources/harness_platform_pipeline_filters/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,28 @@ resource "harness_platform_pipeline_filters" "test" {
filter_visibility = "EveryOne"
}

# pipeline execution filter consisiting services (service_identifiers) filter
resource "harness_platform_pipeline_filters" "execution" {
identifier = "identifier"
name = "name"
org_id = "org_id"
project_id = "project_id"
type = "PipelineSetup"
filter_properties {
name = "pipeline_name"
description = "pipeline_description"
pipeline_identifiers = ["id1", "id2"]
filter_type = "PipelineExecution"
module_properties {
cd {
deployment_types = "Kubernetes"
service_identifiers = ["nginx"]
}
}
}
filter_visibility = "EveryOne"
}


# pipeline filter with tags
resource "harness_platform_pipeline_filters" "example_with_tags" {
Expand Down Expand Up @@ -47,4 +69,5 @@ resource "harness_platform_pipeline_filters" "example_with_tags" {
}
}
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,15 @@ func DataSourcePipelineFilters() *schema.Resource {
Type: schema.TypeString,
},
},
"service_identifiers": {
Description: "Service identifiers of the CD pipeline.",
Type: schema.TypeSet,
Optional: true,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"environment_names": {
Description: "Environment names of the CD pipeline.",
Type: schema.TypeSet,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@ func ResourcePipelineFilters() *schema.Resource {
Type: schema.TypeString,
},
},
"service_identifiers": {
Description: "Service identifiers of the CD pipeline.",
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"environment_names": {
Description: "Environment names of the CD pipeline.",
Type: schema.TypeSet,
Expand Down Expand Up @@ -392,6 +400,9 @@ func buildPipelineFilter(d *schema.ResourceData) *nextgen.PipelineFilter {
if attr := cdProperties["service_names"].(*schema.Set).List(); len(attr) > 0 {
cd["serviceNames"] = attr
}
if attr := cdProperties["service_identifiers"].(*schema.Set).List(); len(attr) > 0 {
cd["serviceIdentifiers"] = attr
}
if attr := cdProperties["environment_names"].(*schema.Set).List(); len(attr) > 0 {
cd["environmentNames"] = attr
}
Expand Down Expand Up @@ -491,6 +502,9 @@ func readPipelineFilter(d *schema.ResourceData, filter *nextgen.PipelineFilter)
if attr, ok := hCdProperties["serviceNames"]; ok {
cdProperties["service_names"] = attr
}
if attr, ok := hCdProperties["serviceIdentifiers"]; ok {
cdProperties["service_identifiers"] = attr
}
if attr, ok := hCdProperties["environmentNames"]; ok {
cdProperties["environment_names"] = attr
}
Expand Down

0 comments on commit aca2822

Please sign in to comment.