From ab9ee69a43dc085994c087e54f7b54933f465cac Mon Sep 17 00:00:00 2001 From: Rohit Karelia Date: Wed, 23 Aug 2023 16:10:45 -0700 Subject: [PATCH 1/8] fix: [CDS-76802]: Mark resource as new (#664) --- .../resource_environment_service_overrides.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/service/platform/environment_service_overrides/resource_environment_service_overrides.go b/internal/service/platform/environment_service_overrides/resource_environment_service_overrides.go index 81f4cf67b..8624b9338 100644 --- a/internal/service/platform/environment_service_overrides/resource_environment_service_overrides.go +++ b/internal/service/platform/environment_service_overrides/resource_environment_service_overrides.go @@ -63,10 +63,17 @@ func resourceEnvironmentServiceOverridesRead(ctx context.Context, d *schema.Reso OrgIdentifier: helpers.BuildField(d, "org_id"), ProjectIdentifier: helpers.BuildField(d, "project_id"), }) + if err != nil { return helpers.HandleReadApiError(err, d, httpResp) } + if resp.Data == nil || len(resp.Data.Content) == 0 { + d.SetId("") + d.MarkNewResource() + return nil + } + readEnvironmentServiceOverridesList(d, resp.Data) return nil From c63338dcc26ce314e6c983945619880039813e20 Mon Sep 17 00:00:00 2001 From: Ved Tambat Date: Fri, 25 Aug 2023 01:28:42 +0530 Subject: [PATCH 2/8] ImportFromGit for Pipeline Entity (#643) * ImportFromGit for Pipeline Entity * UT * UT-2 * post go-client release changes * resource.tf * docs generated * changes --- .changelog/643.txt | 3 + docs/data-sources/platform_pipeline.md | 2 - docs/resources/platform_pipeline.md | 48 ++++++- .../harness_platform_pipeline/resource.tf | 23 +++ go.mod | 10 +- go.sum | 20 +-- .../platform/pipeline/resource_pipeline.go | 135 ++++++++++++++++-- .../pipeline/resource_pipeline_test.go | 55 +++++++ 8 files changed, 266 insertions(+), 30 deletions(-) create mode 100644 .changelog/643.txt diff --git a/.changelog/643.txt b/.changelog/643.txt new file mode 100644 index 000000000..055bc6f58 --- /dev/null +++ b/.changelog/643.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +harness_platform_pipeline - Added support to import pipeline entity from git. +``` \ No newline at end of file diff --git a/docs/data-sources/platform_pipeline.md b/docs/data-sources/platform_pipeline.md index 73574d0f5..328b27580 100644 --- a/docs/data-sources/platform_pipeline.md +++ b/docs/data-sources/platform_pipeline.md @@ -60,5 +60,3 @@ Read-Only: - `file_path` (String) File path of the Entity in the repository. - `repo_name` (String) Name of the repository. - `store_type` (String) Specifies whether the Entity is to be stored in Git or not. Possible values: INLINE, REMOTE. - - diff --git a/docs/resources/platform_pipeline.md b/docs/resources/platform_pipeline.md index ae3bccbd2..c8b6e1b4f 100644 --- a/docs/resources/platform_pipeline.md +++ b/docs/resources/platform_pipeline.md @@ -115,6 +115,29 @@ resource "harness_platform_pipeline" "example" { type: StageRollback EOT } + +### Importing Pipeline from Git +resource "harness_platform_organization" "test" { + identifier = "identifier" + name = "name" +} +resource "harness_platform_pipeline" "test" { + identifier = "gitx" + org_id = "default" + project_id = "V" + name = "gitx" + import_from_git = true + git_import_info { + branch_name = "main" + file_path = ".harness/gitx.yaml" + connector_ref = "account.DoNotDeleteGithub" + repo_name = "open-repo" + } + pipeline_import_request { + pipeline_name = "gitx" + pipeline_description = "Pipeline Description" + } +} ``` @@ -126,15 +149,18 @@ resource "harness_platform_pipeline" "example" { - `name` (String) Name of the resource. - `org_id` (String) Unique identifier of the organization. - `project_id` (String) Unique identifier of the project. -- `yaml` (String) YAML of the pipeline. In YAML, to reference an entity at the organization scope, prefix 'org' to the expression: org.{identifier}. To reference an entity at the account scope, prefix 'account` to the expression: account.{identifier}. For eg, to reference a connector with identifier 'connectorId' at the organization scope in a stage mention it as connectorRef: org.connectorId. ### Optional - `description` (String) Description of the resource. - `git_details` (Block List, Max: 1) Contains parameters related to creating an Entity for Git Experience. (see [below for nested schema](#nestedblock--git_details)) +- `git_import_info` (Block List, Max: 1) Contains Git Information for importing entities from Git (see [below for nested schema](#nestedblock--git_import_info)) +- `import_from_git` (Boolean) Flag to set if importing from Git +- `pipeline_import_request` (Block List, Max: 1) Contains parameters for importing a pipeline (see [below for nested schema](#nestedblock--pipeline_import_request)) - `tags` (Set of String) Tags to associate with the resource. - `template_applied` (Boolean) If true, returns Pipeline YAML with Templates applied on it. - `template_applied_pipeline_yaml` (String) Pipeline YAML after resolving Templates (returned as a String). +- `yaml` (String) YAML of the pipeline. In YAML, to reference an entity at the organization scope, prefix 'org' to the expression: org.{identifier}. To reference an entity at the account scope, prefix 'account` to the expression: account.{identifier}. For eg, to reference a connector with identifier 'connectorId' at the organization scope in a stage mention it as connectorRef: org.connectorId. ### Read-Only @@ -155,6 +181,26 @@ Optional: - `repo_name` (String) Name of the repository. - `store_type` (String) Specifies whether the Entity is to be stored in Git or not. Possible values: INLINE, REMOTE. + + +### Nested Schema for `git_import_info` + +Optional: + +- `branch_name` (String) Name of the branch. +- `connector_ref` (String) Identifier of the Harness Connector used for importing entity from Git To reference a connector at the organization scope, prefix 'org' to the expression: org.{identifier}. To reference a connector at the account scope, prefix 'account` to the expression: account.{identifier}. +- `file_path` (String) File path of the Entity in the repository. +- `repo_name` (String) Name of the repository. + + + +### Nested Schema for `pipeline_import_request` + +Optional: + +- `pipeline_description` (String) Description of the pipeline. +- `pipeline_name` (String) Name of the pipeline. + ## Import Import is supported using the following syntax: diff --git a/examples/resources/harness_platform_pipeline/resource.tf b/examples/resources/harness_platform_pipeline/resource.tf index d760ed864..9c4c86805 100644 --- a/examples/resources/harness_platform_pipeline/resource.tf +++ b/examples/resources/harness_platform_pipeline/resource.tf @@ -100,3 +100,26 @@ resource "harness_platform_pipeline" "example" { type: StageRollback EOT } + +### Importing Pipeline from Git +resource "harness_platform_organization" "test" { + identifier = "identifier" + name = "name" +} +resource "harness_platform_pipeline" "test" { + identifier = "gitx" + org_id = "default" + project_id = "V" + name = "gitx" + import_from_git = true + git_import_info { + branch_name = "main" + file_path = ".harness/gitx.yaml" + connector_ref = "account.DoNotDeleteGithub" + repo_name = "open-repo" + } + pipeline_import_request { + pipeline_name = "gitx" + pipeline_description = "Pipeline Description" + } +} \ No newline at end of file diff --git a/go.mod b/go.mod index 60a6fe563..01b26a10d 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/antihax/optional v1.0.0 github.com/docker/docker v24.0.5+incompatible github.com/harness/harness-go-sdk v0.3.44 - github.com/harness/harness-openapi-go-client v0.0.17 + github.com/harness/harness-openapi-go-client v0.0.18 github.com/hashicorp/go-cleanhttp v0.5.2 github.com/hashicorp/go-retryablehttp v0.7.4 github.com/hashicorp/terraform-plugin-sdk/v2 v2.27.0 @@ -45,11 +45,11 @@ require ( github.com/hashicorp/terraform-json v0.17.1 // indirect github.com/hashicorp/terraform-plugin-go v0.18.0 // indirect github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect - github.com/hashicorp/terraform-registry-address v0.2.1 // indirect + github.com/hashicorp/terraform-registry-address v0.2.2 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect github.com/hashicorp/yamux v0.1.1 // indirect github.com/jhump/protoreflect v1.6.1 // indirect - github.com/jinzhu/copier v0.3.5 // indirect + github.com/jinzhu/copier v0.4.0 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect @@ -75,8 +75,8 @@ require ( golang.org/x/text v0.12.0 // indirect golang.org/x/tools v0.12.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230725213213-b022f6e96895 // indirect - google.golang.org/grpc v1.56.2 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/grpc v1.57.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.3.0 // indirect diff --git a/go.sum b/go.sum index 38706f29a..5435e1756 100644 --- a/go.sum +++ b/go.sum @@ -48,8 +48,8 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/harness/harness-go-sdk v0.3.44 h1:DMcLBqtRiuQGeBT/cqx6jax4oe0NrDJ9Fbjspz7NNdM= github.com/harness/harness-go-sdk v0.3.44/go.mod h1:CPXydorp4zd5Dz2u2FXiHyWL4yd5PQafOMN69cgPSvk= -github.com/harness/harness-openapi-go-client v0.0.17 h1:EZneIyi6sV+dlTgXbawxdVD0OoDmG3mnGHEJbwslRzc= -github.com/harness/harness-openapi-go-client v0.0.17/go.mod h1:u0vqYb994BJGotmEwJevF4L3BNAdU9i8ui2d22gmLPA= +github.com/harness/harness-openapi-go-client v0.0.18 h1:gPhLOSOwjmZJ3aLjJiBbWPOMSBm8h72wbVSfx19eWZM= +github.com/harness/harness-openapi-go-client v0.0.18/go.mod h1:u0vqYb994BJGotmEwJevF4L3BNAdU9i8ui2d22gmLPA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -90,8 +90,8 @@ github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9T github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= github.com/hashicorp/terraform-plugin-sdk/v2 v2.27.0 h1:I8efBnjuDrgPjNF1MEypHy48VgcTIUY4X6rOFunrR3Y= github.com/hashicorp/terraform-plugin-sdk/v2 v2.27.0/go.mod h1:cUEP4ly/nxlHy5HzD6YRrHydtlheGvGRJDhiWqqVik4= -github.com/hashicorp/terraform-registry-address v0.2.1 h1:QuTf6oJ1+WSflJw6WYOHhLgwUiQ0FrROpHPYFtwTYWM= -github.com/hashicorp/terraform-registry-address v0.2.1/go.mod h1:BSE9fIFzp0qWsJUUyGquo4ldV9k2n+psif6NYkBRS3Y= +github.com/hashicorp/terraform-registry-address v0.2.2 h1:lPQBg403El8PPicg/qONZJDC6YlgCVbWDtNmmZKtBno= +github.com/hashicorp/terraform-registry-address v0.2.2/go.mod h1:LtwNbCihUoUZ3RYriyS2wF/lGPB6gF9ICLRtuDk7hSo= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= @@ -100,8 +100,8 @@ github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jhump/protoreflect v1.6.1 h1:4/2yi5LyDPP7nN+Hiird1SAJ6YoxUm13/oxHGRnbPd8= github.com/jhump/protoreflect v1.6.1/go.mod h1:RZQ/lnuN+zqeRVpQigTwO6o0AJUkxbnSnpuG7toUTG4= -github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg= -github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= +github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8= +github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -274,11 +274,11 @@ google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9Ywl google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20170818010345-ee236bd376b0/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230725213213-b022f6e96895 h1:co8AMhI481nhd3WBfW2mq5msyQHNBcGn7G9GCEqz45k= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230725213213-b022f6e96895/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= +google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/internal/service/platform/pipeline/resource_pipeline.go b/internal/service/platform/pipeline/resource_pipeline.go index 9d1e43ac4..06f61dd05 100644 --- a/internal/service/platform/pipeline/resource_pipeline.go +++ b/internal/service/platform/pipeline/resource_pipeline.go @@ -27,29 +27,34 @@ func ResourcePipeline() *schema.Resource { "yaml": { Description: "YAML of the pipeline." + helpers.Descriptions.YamlText.String(), Type: schema.TypeString, - Required: true, + Optional: true, + Computed: true, }, "git_details": { Description: "Contains parameters related to creating an Entity for Git Experience.", Type: schema.TypeList, MaxItems: 1, Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "branch_name": { Description: "Name of the branch.", Type: schema.TypeString, Optional: true, + Computed: true, }, "file_path": { Description: "File path of the Entity in the repository.", Type: schema.TypeString, Optional: true, + Computed: true, }, "commit_message": { Description: "Commit message used for the merge commit.", Type: schema.TypeString, Optional: true, + Computed: true, }, "base_branch": { Description: "Name of the default branch (this checks out a new branch titled by branch_name).", @@ -61,17 +66,20 @@ func ResourcePipeline() *schema.Resource { Description: "Identifier of the Harness Connector used for CRUD operations on the Entity." + helpers.Descriptions.ConnectorRefText.String(), Type: schema.TypeString, Optional: true, + Computed: true, }, "store_type": { Description: "Specifies whether the Entity is to be stored in Git or not. Possible values: INLINE, REMOTE.", Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{"INLINE", "REMOTE"}, false), + Computed: true, }, "repo_name": { Description: "Name of the repository.", Type: schema.TypeString, Optional: true, + Computed: true, }, "last_object_id": { Description: "Last object identifier (for Github). To be provided only when updating Pipeline.", @@ -98,6 +106,61 @@ func ResourcePipeline() *schema.Resource { Type: schema.TypeString, Optional: true, }, + "import_from_git": { + Description: "Flag to set if importing from Git", + Type: schema.TypeBool, + Optional: true, + }, + "git_import_info": { + Description: "Contains Git Information for importing entities from Git", + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "branch_name": { + Description: "Name of the branch.", + Type: schema.TypeString, + Optional: true, + }, + "file_path": { + Description: "File path of the Entity in the repository.", + Type: schema.TypeString, + Optional: true, + }, + "connector_ref": { + Description: "Identifier of the Harness Connector used for importing entity from Git" + helpers.Descriptions.ConnectorRefText.String(), + Type: schema.TypeString, + Optional: true, + }, + "repo_name": { + Description: "Name of the repository.", + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "pipeline_import_request": { + Description: "Contains parameters for importing a pipeline", + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "pipeline_name": { + Description: "Name of the pipeline.", + Type: schema.TypeString, + Optional: true, + }, + "pipeline_description": { + Description: "Description of the pipeline.", + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, }, } @@ -160,18 +223,29 @@ func resourcePipelineCreateOrUpdate(ctx context.Context, d *schema.ResourceData, template_applied := d.Get("template_applied").(bool) if id == "" { - pipeline := buildCreatePipeline(d) - if pipeline.GitDetails != nil { - base_branch = optional.NewString(pipeline.GitDetails.BaseBranch) - store_type = optional.NewString(pipeline.GitDetails.StoreType) - commit_message = optional.NewString(pipeline.GitDetails.CommitMessage) - connector_ref = optional.NewString(pipeline.GitDetails.ConnectorRef) - branch_name = pipeline.GitDetails.BranchName - } + if d.Get("import_from_git").(bool) { + pipeline_id = d.Get("pipeline_import_request.0.pipeline_name").(string) + + pipeline_import_request_body := createImportFromGitRequest(d) + + _, httpResp, err = c.PipelinesApi.ImportPipelineFromGit(ctx, org_id, project_id, pipeline_id, + &nextgen.PipelinesApiImportPipelineFromGitOpts{ + Body: optional.NewInterface(pipeline_import_request_body), + HarnessAccount: optional.NewString(c.AccountId)}) + } else { + pipeline := buildCreatePipeline(d) + if pipeline.GitDetails != nil { + base_branch = optional.NewString(pipeline.GitDetails.BaseBranch) + store_type = optional.NewString(pipeline.GitDetails.StoreType) + commit_message = optional.NewString(pipeline.GitDetails.CommitMessage) + connector_ref = optional.NewString(pipeline.GitDetails.ConnectorRef) + branch_name = pipeline.GitDetails.BranchName + } - pipeline_id = pipeline.Identifier - _, httpResp, err = c.PipelinesApi.CreatePipeline(ctx, pipeline, org_id, project_id, - &nextgen.PipelinesApiCreatePipelineOpts{HarnessAccount: optional.NewString(c.AccountId)}) + pipeline_id = pipeline.Identifier + _, httpResp, err = c.PipelinesApi.CreatePipeline(ctx, pipeline, org_id, project_id, + &nextgen.PipelinesApiCreatePipelineOpts{HarnessAccount: optional.NewString(c.AccountId)}) + } } else { pipeline := buildUpdatePipeline(d) store_type = helpers.BuildField(d, "git_details.0.store_type") @@ -202,6 +276,43 @@ func resourcePipelineCreateOrUpdate(ctx context.Context, d *schema.ResourceData, return nil } +func createImportFromGitRequest(d *schema.ResourceData) *nextgen.PipelineImportRequestBody { + + pipeline_git_import_info := &nextgen.GitImportInfo{} + if attr, ok := d.GetOk("git_import_info"); ok { + config := attr.([]interface{})[0].(map[string]interface{}) + if attr, ok := config["branch_name"]; ok { + pipeline_git_import_info.BranchName = attr.(string) + } + if attr, ok := config["file_path"]; ok { + pipeline_git_import_info.FilePath = attr.(string) + } + if attr, ok := config["connector_ref"]; ok { + pipeline_git_import_info.ConnectorRef = attr.(string) + } + if attr, ok := config["repo_name"]; ok { + pipeline_git_import_info.RepoName = attr.(string) + } + } + + pipeline_import_request := &nextgen.PipelineImportRequestDto{} + if attr, ok := d.GetOk("pipeline_import_request"); ok { + config := attr.([]interface{})[0].(map[string]interface{}) + if attr, ok := config["pipeline_name"]; ok { + pipeline_import_request.PipelineName = attr.(string) + } + if attr, ok := config["pipeline_description"]; ok { + pipeline_import_request.PipelineDescription = attr.(string) + } + } + + pipeline_import_request_body := &nextgen.PipelineImportRequestBody{} + pipeline_import_request_body.GitImportInfo = pipeline_git_import_info + pipeline_import_request_body.PipelineImportRequest = pipeline_import_request + + return pipeline_import_request_body +} + func resourcePipelineDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { c, ctx := meta.(*internal.Session).GetClientWithContext(ctx) diff --git a/internal/service/platform/pipeline/resource_pipeline_test.go b/internal/service/platform/pipeline/resource_pipeline_test.go index c278e60a3..03a59505a 100644 --- a/internal/service/platform/pipeline/resource_pipeline_test.go +++ b/internal/service/platform/pipeline/resource_pipeline_test.go @@ -87,6 +87,35 @@ func TestAccResourcePipelineInline(t *testing.T) { }) } +func TestAccResourcePipelineImportFromGit(t *testing.T) { + id := fmt.Sprintf("%s_%s", t.Name(), utils.RandStringBytes(6)) + name := id + + resourceName := "harness_platform_pipeline.test" + + resource.UnitTest(t, resource.TestCase{ + PreCheck: func() { acctest.TestAccPreCheck(t) }, + ProviderFactories: acctest.ProviderFactories, + CheckDestroy: testAccPipelineDestroy(resourceName), + Steps: []resource.TestStep{ + { + Config: testAccResourcePipelineImportFromGit(id, name), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "id", "gitx"), + resource.TestCheckResourceAttr(resourceName, "name", "gitx"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: acctest.ProjectResourceImportStateIdFunc(resourceName), + ImportStateVerifyIgnore: []string{"git_import_info.0.branch_name", "git_import_info.0.connector_ref", "git_import_info.0.file_path","git_import_info.0.repo_name", "import_from_git", "pipeline_import_request.0.pipeline_description", "pipeline_import_request.0.pipeline_name", "git_import_info.#", "git_import_info.0.%", "pipeline_import_request.#", "pipeline_import_request.0.%"}, + }, + }, + }) +} + func TestAccResourcePipeline_DeleteUnderlyingResource(t *testing.T) { name := t.Name() id := fmt.Sprintf("%s_%s", name, utils.RandStringBytes(5)) @@ -369,3 +398,29 @@ func testAccResourcePipelineInline(id string, name string) string { } `, id, name) } + +func testAccResourcePipelineImportFromGit(id string, name string) string { + return fmt.Sprintf(` + resource "harness_platform_organization" "test" { + identifier = "%[1]s" + name = "%[2]s" + } + resource "harness_platform_pipeline" "test" { + identifier = "gitx" + org_id = "default" + project_id = "V" + name = "gitx" + import_from_git = true + git_import_info { + branch_name = "main" + file_path = ".harness/gitx.yaml" + connector_ref = "account.DoNotDeleteGithub" + repo_name = "open-repo" + } + pipeline_import_request { + pipeline_name = "gitx" + pipeline_description = "Pipeline Description" + } + } + `, id, name) +} From 3e41bdb874ed0362d9fed5396c9eba44918def60 Mon Sep 17 00:00:00 2001 From: Sarthak Kasat <109350689+sarthakkasat@users.noreply.github.com> Date: Fri, 25 Aug 2023 19:41:39 +0530 Subject: [PATCH 3/8] fix: [CDS-77684]: Handle null point exception if created by field is nil (#665) * [fix]: [CDS-77684]: Handle null point exception if created by field is not set * fix: [CDS-77684]: Add nil check to file_store * fix: [CDS-77684]: Update func name * fix: [CDS-77684]: Update change.log * Update 665.txt --------- Co-authored-by: Yogesh Chauhan --- .changelog/665.txt | 3 +++ .../service/platform/file_store/file_store_utils.go | 13 ++++++++++++- .../service/platform/file_store/resource_file.go | 8 ++++---- .../service/platform/file_store/resource_folder.go | 8 ++++---- 4 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 .changelog/665.txt diff --git a/.changelog/665.txt b/.changelog/665.txt new file mode 100644 index 000000000..c90385a48 --- /dev/null +++ b/.changelog/665.txt @@ -0,0 +1,3 @@ +```release-note:bug +Fixed harness_platform_file_store_folder create resource plugin crash, when service account token was used to create +``` diff --git a/internal/service/platform/file_store/file_store_utils.go b/internal/service/platform/file_store/file_store_utils.go index 5cde1da92..523cbe8b8 100644 --- a/internal/service/platform/file_store/file_store_utils.go +++ b/internal/service/platform/file_store/file_store_utils.go @@ -79,5 +79,16 @@ func getOptionalString(str interface{}) optional.String { return optional.NewString(v) } +func getEmail(user *nextgen.EmbeddedUserDetailsDto) string { + if user != nil { + return user.Email + } + return "" +} - +func getName(user *nextgen.EmbeddedUserDetailsDto) string { + if user != nil { + return user.Name + } + return "" +} diff --git a/internal/service/platform/file_store/resource_file.go b/internal/service/platform/file_store/resource_file.go index 91221fc17..648305702 100644 --- a/internal/service/platform/file_store/resource_file.go +++ b/internal/service/platform/file_store/resource_file.go @@ -269,14 +269,14 @@ func readFileNode(d *schema.ResourceData, file *nextgen.File, fileContentOpt opt d.Set(tags, FlattenTags(file.Tags)) d.Set(createdBy, []interface{}{ map[string]interface{}{ - "email": file.CreatedBy.Email, - "name": file.CreatedBy.Name, + "email": getEmail(file.CreatedBy), + "name": getName(file.CreatedBy), }, }) d.Set(lastModifiedBy, []interface{}{ map[string]interface{}{ - "email": file.LastModifiedBy.Email, - "name": file.LastModifiedBy.Name, + "email": getEmail(file.LastModifiedBy), + "name": getName(file.LastModifiedBy), }, }) d.Set(lastModifiedAt, file.LastModifiedAt) diff --git a/internal/service/platform/file_store/resource_folder.go b/internal/service/platform/file_store/resource_folder.go index fe2afd405..2113ca466 100644 --- a/internal/service/platform/file_store/resource_folder.go +++ b/internal/service/platform/file_store/resource_folder.go @@ -217,14 +217,14 @@ func readFolderNode(d *schema.ResourceData, file *nextgen.File, fileContentOpt o d.Set(path, file.Path) d.Set(createdBy, []interface{}{ map[string]interface{}{ - "email": file.CreatedBy.Email, - "name": file.CreatedBy.Name, + "email": getEmail(file.CreatedBy), + "name": getName(file.CreatedBy), }, }) d.Set(lastModifiedBy, []interface{}{ map[string]interface{}{ - "email": file.LastModifiedBy.Email, - "name": file.LastModifiedBy.Name, + "email": getEmail(file.LastModifiedBy), + "name": getName(file.LastModifiedBy), }, }) d.Set(lastModifiedAt, file.LastModifiedAt) From 150ca896f5d5f1a48e54dbbeb8fc8c16aad8590c Mon Sep 17 00:00:00 2001 From: Ansuman Satapathy Date: Mon, 28 Aug 2023 16:49:36 +0530 Subject: [PATCH 4/8] feat: [OIP-808]: updated monitored service document and examples (#669) * updated monitored service * feat: [OIP-808]: updated monitored service document and examples * feat: [OIP-808]: updated changelog and go.mod version for sdk and go.sum --- .changelog/669.txt | 8 + docs/resources/platform_monitored_service.md | 542 ++++++++++- .../resource.tf | 532 ++++++++++- go.mod | 20 +- go.sum | 53 ++ .../data_source_monitored_service_test.go | 849 +++++++++++++++++- .../resource_monitored_service.go | 52 +- .../resource_monitored_service_test.go | 3 +- .../platform/monitored_service/utils.go | 290 ++++-- 9 files changed, 2139 insertions(+), 210 deletions(-) create mode 100644 .changelog/669.txt diff --git a/.changelog/669.txt b/.changelog/669.txt new file mode 100644 index 000000000..74b24df2c --- /dev/null +++ b/.changelog/669.txt @@ -0,0 +1,8 @@ +```release-note:enhancement +data_source_monitored_service_test.go Added tests for multiple healthsources such as Prometheus, Datadog etc. +resource_monitored_service.go Added version field and renamed MonitoredServiceSpec to MonitoredService +resource_monitored_service_test.go renamed MonitoredServiceSpec to MonitoredService +utils.go Deserializer updated with new health sources such as azure, signalFx, loki and sumologic +platform_monitored_service.md Added docs for health sources such as azure, signalFx, loki and sumologic +resource.tf Added examples for all newly added health sources, datadog and prometheus +``` \ No newline at end of file diff --git a/docs/resources/platform_monitored_service.md b/docs/resources/platform_monitored_service.md index e8ea3c6ee..fede13b38 100644 --- a/docs/resources/platform_monitored_service.md +++ b/docs/resources/platform_monitored_service.md @@ -13,11 +13,11 @@ Resource for creating a monitored service. ## Example Usage ```terraform +#Sample template for Elastic Search Log Health Source resource "harness_platform_monitored_service" "example" { - account_id = "account_id" - org_id = "default" - project_id = "default_project" - identifier = "Terraform" + org_id = "org_id" + project_id = "project_id" + identifier = "identifier" request { name = "name" type = "Application" @@ -29,27 +29,35 @@ resource "harness_platform_monitored_service" "example" { name = "name" identifier = "identifier" type = "ElasticSearch" + version = "v2" spec = jsonencode({ connectorRef = "connectorRef" - feature = "feature" - queries = [ - { - name = "name" - query = "query" - index = "index" - serviceInstanceIdentifier = "serviceInstanceIdentifier" - timeStampIdentifier = "timeStampIdentifier" - timeStampFormat = "timeStampFormat" - messageIdentifier = "messageIdentifier" + queryDefinitions = [ + { + name = "name" + query = "query" + index = "index" + groupName = "Logs_Group" + queryParams = { + index = "index" + serviceInstanceField = "serviceInstanceIdentifier" + timeStampIdentifier = "timeStampIdentifier" + timeStampFormat = "timeStampFormat" + messageIdentifier = "messageIdentifier" + } }, { - name = "name2" - query = "query2" - index = "index2" - serviceInstanceIdentifier = "serviceInstanceIdentifier2" - timeStampIdentifier = "timeStampIdentifier2" - timeStampFormat = "timeStampFormat2" - messageIdentifier = "messageIdentifier2" + name = "name2" + query = "query2" + index = "index2" + groupName = "Logs_Group" + queryParams = { + index = "index" + serviceInstanceField = "serviceInstanceIdentifier" + timeStampIdentifier = "timeStampIdentifier" + timeStampFormat = "timeStampFormat" + messageIdentifier = "messageIdentifier" + } } ] }) @@ -71,6 +79,468 @@ resource "harness_platform_monitored_service" "example" { notification_rule_ref = "notification_rule_ref1" enabled = false } + template_ref = "template_ref" + version_label = "version_label" + } +} +#Sample template for Sumologic Metrics Health Source +resource "harness_platform_monitored_service" "example1" { + org_id = "org_id" + project_id = "project_id" + identifier = "identifier" + request { + name = "name" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "sumologicmetrics" + identifier = "sumo_metric_identifier" + type = "SumologicMetrics" + version = "v2" + spec = jsonencode({ + connectorRef = "connectorRef" + queryDefinitions = [ + { + name = "metric_cpu" + identifier = "metric_cpu" + query = "metric=cpu" + groupName = "g1" + queryParams = { + } + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + liveMonitoringEnabled = "true" + continuousVerificationEnabled = "true" + sliEnabled = "false" + }, + { + name = "name2" + identifier = "identifier2" + groupName = "g2" + query = "metric=memory" + queryParams = { + } + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + liveMonitoringEnabled = "false" + continuousVerificationEnabled = "false" + sliEnabled = "false" + } + ] + }) + } + template_ref = "template_ref" + version_label = "version_label" + } +} +#Sample template for Sumologic Log Health Source +resource "harness_platform_monitored_service" "example2" { + org_id = "org_id" + project_id = "project_id" + identifier = "identifier" + request { + name = "name" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "sumologic" + identifier = "sumo_metric_identifier" + type = "SumologicLogs" + version = "v2" + spec = jsonencode({ + connectorRef = "connectorRef" + queryDefinitions = [ + { + name = "log1" + identifier = "log1" + query = "*" + groupName = "Logs Group" + queryParams = { + serviceInstanceField = "_sourcehost" + } + }, + { + name = "log2" + identifier = "identifier2" + groupName = "g2" + query = "error" + queryParams = { + serviceInstanceField = "_sourcehost" + } + } + ] + }) + } + template_ref = "template_ref" + version_label = "version_label" + } +} + +#Sample template for Splunk Signal FX Health Source +resource "harness_platform_monitored_service" "example3" { + org_id = "org_id" + project_id = "project_id" + identifier = "identifier" + request { + name = "name" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "signalfxmetrics" + identifier = "signalfxmetrics" + type = "SplunkSignalFXMetrics" + version = "v2" + spec = jsonencode({ + connectorRef = "connectorRef" + queryDefinitions = [ + { + name = "metric_infra_cpu" + identifier = "metric_infra_cpu" + query = "***" + groupName = "g" + riskProfile = { + riskCategory = "Errors" + thresholdTypes = [ + "ACT_WHEN_HIGHER", + "ACT_WHEN_LOWER" + ] + } + liveMonitoringEnabled = "true" + continuousVerificationEnabled = "true" + sliEnabled = "false" + }, + { + name = "name2" + identifier = "identifier2" + groupName = "g2" + query = "*" + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + liveMonitoringEnabled = "true" + continuousVerificationEnabled = "false" + sliEnabled = "false" + } + ] + }) + } + template_ref = "template_ref" + version_label = "version_label" + } +} + +#Sample template for Grafana Loki Log Health Source +resource "harness_platform_monitored_service" "example4" { + org_id = "org_id" + project_id = "project_id" + identifier = "identifier" + request { + name = "name" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "Test" + identifier = "Test" + type = "GrafanaLokiLogs" + version = "v2" + spec = jsonencode({ + connectorRef = "connectorRef" + queryDefinitions = [ + { + name = "Demo" + identifier = "Demo" + query = "{job=~\".+\"}" + groupName = "Log_Group" + queryParams = { + serviceInstanceField = "job" + } + }, + { + name = "log2" + identifier = "identifier2" + groupName = "g2" + query = "error" + queryParams = { + serviceInstanceField = "_sourcehost" + } + liveMonitoringEnabled = "false" + continuousVerificationEnabled = "false" + sliEnabled = "false" + } + ] + }) + } + template_ref = "template_ref" + version_label = "version_label" + } +} + +#Sample template for Azure Metrics Health Source +resource "harness_platform_monitored_service" "example5" { + org_id = "org_id" + project_id = "project_id" + identifier = "identifier" + request { + name = "name" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "azure metrics verify step" + identifier = "azure_metrics_verify_step" + type = "AzureMetrics" + version = "v2" + spec = jsonencode({ + connectorRef = "connectorRef" + queryDefinitions = [ + { + name = "metric" + identifier = "metric" + query = "default" + groupName = "g1" + queryParams = { + serviceInstanceField = "host" + index = "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test", + healthSourceMetricName = "cpuUsagePercentage", + healthSourceMetricNamespace = "insights.container/nodes", + aggregationType = "average" + } + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + liveMonitoringEnabled = "true" + continuousVerificationEnabled = "true" + sliEnabled = "false" + }, + { + name = "name2" + identifier = "identifier2" + groupName = "g2" + queryParams = { + serviceInstanceField = "host" + index = "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test", + healthSourceMetricName = "cpuUsagePercentage", + healthSourceMetricNamespace = "insights.container/nodes", + aggregationType = "average" + } + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + liveMonitoringEnabled = "false" + continuousVerificationEnabled = "false" + sliEnabled = "false" + } + ] + }) + } + template_ref = "template_ref" + version_label = "version_label" + } +} +#Sample template for Azure Log Health Source +resource "harness_platform_monitored_service" "example6" { + org_id = "org_id" + project_id = "project_id" + identifier = "identifier" + request { + name = "name" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "Demo azure" + identifier = "Demo_azure" + type = "AzureLogs" + version = "v2" + spec = jsonencode({ + connectorRef = "connectorRef" + queryDefinitions = [ + { + name = "name2" + identifier = "identifier2" + groupName = "g2" + query = "*" + queryParams = { + serviceInstanceField = "Name", + timeStampIdentifier = "StartedTime", + messageIdentifier = "Image", + index = "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test" + } + liveMonitoringEnabled = "false" + continuousVerificationEnabled = "false" + } + ] + }) + } + template_ref = "template_ref" + version_label = "version_label" + } +} +#Sample template for Prometheus Metrics Health Source +resource "harness_platform_monitored_service" "example7" { + org_id = "org_id" + project_id = "project_id" + identifier = "identifier" + request { + name = "name" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "prometheus metrics verify step" + identifier = "prometheus_metrics" + type = "Prometheus" + spec = jsonencode({ + connectorRef = "connectorRef" + metricDefinitions = [ + { + identifier = "Prometheus_Metric", + metricName = "Prometheus Metric", + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + analysis = { + liveMonitoring = { + enabled = true + } + deploymentVerification = { + enabled = true + serviceInstanceFieldName = "pod_name" + } + } + sli : { + enabled = true + } + query = "count(up{group=\"cv\",group=\"cv\"})" + groupName = "met" + isManualQuery = true + } + ] + }) + } + template_ref = "template_ref" + version_label = "version_label" + } +} +#Sample template for Datadog Metrics Health Source +resource "harness_platform_monitored_service" "example8" { + org_id = "org_id" + project_id = "project_id" + identifier = "identifier" + request { + name = "name" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "ddm" + identifier = "ddm" + type = "DatadogMetrics" + spec = jsonencode({ + connectorRef = "connectorRef" + feature = "Datadog Cloud Metrics" + metricDefinitions = [ + { + metricName = "metric" + metricPath = "M1" + identifier = "metric" + query = "avg:kubernetes.cpu.limits{*}.rollup(avg, 60);\navg:kubernetes.cpu.limits{*}.rollup(avg, 30);\n(a+b)/10" + isManualQuery = true + isCustomCreatedMetric = true + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + analysis = { + liveMonitoring = { + enabled = true + } + deploymentVerification = { + enabled = true + serviceInstanceFieldName = "pod" + } + } + sli : { + enabled = true + } + }, + { + metricName = "dashboard_metric_cpu" + identifier = "metric_cpu" + query = "avg:kubernetes.cpu.limits{*}.rollup(avg, 60);\navg:kubernetes.cpu.limits{*}.rollup(avg, 30);\n(a+b)/10" + isManualQuery = false + dashboardName = "dashboard" + metricPath = "M1" + groupingQuery = "avg:kubernetes.cpu.limits{*} by {host}.rollup(avg, 60)" + metric = "kubernetes.cpu.limits" + aggregation = "avg" + isCustomCreatedMetric = true + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + analysis = { + liveMonitoring = { + enabled = true + } + deploymentVerification = { + enabled = true + serviceInstanceFieldName = "pod" + } + } + sli : { + enabled = true + } + } + ] + }) + } + template_ref = "template_ref" + version_label = "version_label" } } ``` @@ -104,16 +574,16 @@ Required: Optional: +- `change_sources` (Block Set) Set of change sources for the monitored service. (see [below for nested schema](#nestedblock--request--change_sources)) - `dependencies` (Block Set) Dependencies of the monitored service. (see [below for nested schema](#nestedblock--request--dependencies)) - `description` (String) Description for the monitored service. +- `enabled` (Boolean, Deprecated) Enable or disable the monitored service. - `environment_ref_list` (List of String) Environment reference list for the monitored service. +- `health_sources` (Block Set) Set of health sources for the monitored service. (see [below for nested schema](#nestedblock--request--health_sources)) - `notification_rule_refs` (Block List) Notification rule references for the monitored service. (see [below for nested schema](#nestedblock--request--notification_rule_refs)) -- `enabled` (Boolean) Enable or disable the monitored service. Enabled field is deprecated. - `tags` (Set of String) Tags for the monitored service. comma-separated key value string pairs. - `template_ref` (String) Template reference for the monitored service. - `version_label` (String) Template version label for the monitored service. -- `change_sources` (Block Set) Set of change sources for the monitored service. (see [below for nested schema](#nestedblock--request--change_sources)) -- `health_sources` (Block Set) Set of health sources for the monitored service. (see [below for nested schema](#nestedblock--request--health_sources)) ### Nested Schema for `request.change_sources` @@ -131,6 +601,19 @@ Optional: - `spec` (String) Specification of the change source. Depends on the type of the change source. + +### Nested Schema for `request.dependencies` + +Required: + +- `monitored_service_identifier` (String) Monitored service identifier of the dependency. +- `type` (String) Type of the service dependency. + +Optional: + +- `dependency_metadata` (String) Dependency metadata for the monitored service. + + ### Nested Schema for `request.health_sources` @@ -141,18 +624,9 @@ Required: - `spec` (String) Specification of the health source. Depends on the type of the health source. - `type` (String) Type of the health source. - - -### Nested Schema for `request.dependencies` - -Required: - -- `monitored_service_identifier` (String) Monitored service identifier of the dependency. -- `type` (String) Type of the service dependency. - Optional: -- `dependency_metadata` (String) Dependency metadata for the monitored service. +- `version` (String) Version of the health source. diff --git a/examples/resources/harness_platform_monitored_service/resource.tf b/examples/resources/harness_platform_monitored_service/resource.tf index d7d37dc9a..512053c0f 100644 --- a/examples/resources/harness_platform_monitored_service/resource.tf +++ b/examples/resources/harness_platform_monitored_service/resource.tf @@ -1,60 +1,530 @@ +#Sample template for Elastic Search Log Health Source resource "harness_platform_monitored_service" "example" { - org_id = "org_id" + org_id = "org_id" project_id = "project_id" identifier = "identifier" request { - name = "name" - type = "Application" - description = "description" - service_ref = "service_ref" + name = "name" + type = "Application" + description = "description" + service_ref = "service_ref" environment_ref = "environment_ref" - tags = ["foo:bar", "bar:foo"] + tags = ["foo:bar", "bar:foo"] health_sources { - name = "name" + name = "name" identifier = "identifier" - type = "ElasticSearch" + type = "ElasticSearch" + version = "v2" spec = jsonencode({ connectorRef = "connectorRef" - feature = "feature" - queries = [ + queryDefinitions = [ { - name = "name" - query = "query" - index = "index" - serviceInstanceIdentifier = "serviceInstanceIdentifier" - timeStampIdentifier = "timeStampIdentifier" - timeStampFormat = "timeStampFormat" - messageIdentifier = "messageIdentifier" + name = "name" + query = "query" + index = "index" + groupName = "Logs_Group" + queryParams = { + index = "index" + serviceInstanceField = "serviceInstanceIdentifier" + timeStampIdentifier = "timeStampIdentifier" + timeStampFormat = "timeStampFormat" + messageIdentifier = "messageIdentifier" + } }, { - name = "name2" - query = "query2" - index = "index2" - serviceInstanceIdentifier = "serviceInstanceIdentifier2" - timeStampIdentifier = "timeStampIdentifier2" - timeStampFormat = "timeStampFormat2" - messageIdentifier = "messageIdentifier2" + name = "name2" + query = "query2" + index = "index2" + groupName = "Logs_Group" + queryParams = { + index = "index" + serviceInstanceField = "serviceInstanceIdentifier" + timeStampIdentifier = "timeStampIdentifier" + timeStampFormat = "timeStampFormat" + messageIdentifier = "messageIdentifier" + } } - ]}) + ] + }) } change_sources { - name = "csName1" + name = "csName1" identifier = "harness_cd_next_gen" - type = "HarnessCDNextGen" - enabled = true + type = "HarnessCDNextGen" + enabled = true spec = jsonencode({ }) category = "Deployment" } notification_rule_refs { notification_rule_ref = "notification_rule_ref" - enabled = true + enabled = true } notification_rule_refs { notification_rule_ref = "notification_rule_ref1" - enabled = false + enabled = false + } + template_ref = "template_ref" + version_label = "version_label" + } +} +#Sample template for Sumologic Metrics Health Source +resource "harness_platform_monitored_service" "example1" { + org_id = "org_id" + project_id = "project_id" + identifier = "identifier" + request { + name = "name" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "sumologicmetrics" + identifier = "sumo_metric_identifier" + type = "SumologicMetrics" + version = "v2" + spec = jsonencode({ + connectorRef = "connectorRef" + queryDefinitions = [ + { + name = "metric_cpu" + identifier = "metric_cpu" + query = "metric=cpu" + groupName = "g1" + queryParams = { + } + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + liveMonitoringEnabled = "true" + continuousVerificationEnabled = "true" + sliEnabled = "false" + }, + { + name = "name2" + identifier = "identifier2" + groupName = "g2" + query = "metric=memory" + queryParams = { + } + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + liveMonitoringEnabled = "false" + continuousVerificationEnabled = "false" + sliEnabled = "false" + } + ] + }) + } + template_ref = "template_ref" + version_label = "version_label" + } +} +#Sample template for Sumologic Log Health Source +resource "harness_platform_monitored_service" "example2" { + org_id = "org_id" + project_id = "project_id" + identifier = "identifier" + request { + name = "name" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "sumologic" + identifier = "sumo_metric_identifier" + type = "SumologicLogs" + version = "v2" + spec = jsonencode({ + connectorRef = "connectorRef" + queryDefinitions = [ + { + name = "log1" + identifier = "log1" + query = "*" + groupName = "Logs Group" + queryParams = { + serviceInstanceField = "_sourcehost" + } + }, + { + name = "log2" + identifier = "identifier2" + groupName = "g2" + query = "error" + queryParams = { + serviceInstanceField = "_sourcehost" + } + } + ] + }) + } + template_ref = "template_ref" + version_label = "version_label" + } +} + +#Sample template for Splunk Signal FX Health Source +resource "harness_platform_monitored_service" "example3" { + org_id = "org_id" + project_id = "project_id" + identifier = "identifier" + request { + name = "name" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "signalfxmetrics" + identifier = "signalfxmetrics" + type = "SplunkSignalFXMetrics" + version = "v2" + spec = jsonencode({ + connectorRef = "connectorRef" + queryDefinitions = [ + { + name = "metric_infra_cpu" + identifier = "metric_infra_cpu" + query = "***" + groupName = "g" + riskProfile = { + riskCategory = "Errors" + thresholdTypes = [ + "ACT_WHEN_HIGHER", + "ACT_WHEN_LOWER" + ] + } + liveMonitoringEnabled = "true" + continuousVerificationEnabled = "true" + sliEnabled = "false" + }, + { + name = "name2" + identifier = "identifier2" + groupName = "g2" + query = "*" + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + liveMonitoringEnabled = "true" + continuousVerificationEnabled = "false" + sliEnabled = "false" + } + ] + }) + } + template_ref = "template_ref" + version_label = "version_label" + } +} + +#Sample template for Grafana Loki Log Health Source +resource "harness_platform_monitored_service" "example4" { + org_id = "org_id" + project_id = "project_id" + identifier = "identifier" + request { + name = "name" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "Test" + identifier = "Test" + type = "GrafanaLokiLogs" + version = "v2" + spec = jsonencode({ + connectorRef = "connectorRef" + queryDefinitions = [ + { + name = "Demo" + identifier = "Demo" + query = "{job=~\".+\"}" + groupName = "Log_Group" + queryParams = { + serviceInstanceField = "job" + } + }, + { + name = "log2" + identifier = "identifier2" + groupName = "g2" + query = "error" + queryParams = { + serviceInstanceField = "_sourcehost" + } + liveMonitoringEnabled = "false" + continuousVerificationEnabled = "false" + sliEnabled = "false" + } + ] + }) + } + template_ref = "template_ref" + version_label = "version_label" + } +} + +#Sample template for Azure Metrics Health Source +resource "harness_platform_monitored_service" "example5" { + org_id = "org_id" + project_id = "project_id" + identifier = "identifier" + request { + name = "name" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "azure metrics verify step" + identifier = "azure_metrics_verify_step" + type = "AzureMetrics" + version = "v2" + spec = jsonencode({ + connectorRef = "connectorRef" + queryDefinitions = [ + { + name = "metric" + identifier = "metric" + query = "default" + groupName = "g1" + queryParams = { + serviceInstanceField = "host" + index = "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test", + healthSourceMetricName = "cpuUsagePercentage", + healthSourceMetricNamespace = "insights.container/nodes", + aggregationType = "average" + } + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + liveMonitoringEnabled = "true" + continuousVerificationEnabled = "true" + sliEnabled = "false" + }, + { + name = "name2" + identifier = "identifier2" + groupName = "g2" + queryParams = { + serviceInstanceField = "host" + index = "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test", + healthSourceMetricName = "cpuUsagePercentage", + healthSourceMetricNamespace = "insights.container/nodes", + aggregationType = "average" + } + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + liveMonitoringEnabled = "false" + continuousVerificationEnabled = "false" + sliEnabled = "false" + } + ] + }) + } + template_ref = "template_ref" + version_label = "version_label" + } +} +#Sample template for Azure Log Health Source +resource "harness_platform_monitored_service" "example6" { + org_id = "org_id" + project_id = "project_id" + identifier = "identifier" + request { + name = "name" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "Demo azure" + identifier = "Demo_azure" + type = "AzureLogs" + version = "v2" + spec = jsonencode({ + connectorRef = "connectorRef" + queryDefinitions = [ + { + name = "name2" + identifier = "identifier2" + groupName = "g2" + query = "*" + queryParams = { + serviceInstanceField = "Name", + timeStampIdentifier = "StartedTime", + messageIdentifier = "Image", + index = "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test" + } + liveMonitoringEnabled = "false" + continuousVerificationEnabled = "false" + } + ] + }) + } + template_ref = "template_ref" + version_label = "version_label" + } +} +#Sample template for Prometheus Metrics Health Source +resource "harness_platform_monitored_service" "example7" { + org_id = "org_id" + project_id = "project_id" + identifier = "identifier" + request { + name = "name" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "prometheus metrics verify step" + identifier = "prometheus_metrics" + type = "Prometheus" + spec = jsonencode({ + connectorRef = "connectorRef" + metricDefinitions = [ + { + identifier = "Prometheus_Metric", + metricName = "Prometheus Metric", + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + analysis = { + liveMonitoring = { + enabled = true + } + deploymentVerification = { + enabled = true + serviceInstanceFieldName = "pod_name" + } + } + sli : { + enabled = true + } + query = "count(up{group=\"cv\",group=\"cv\"})" + groupName = "met" + isManualQuery = true + } + ] + }) + } + template_ref = "template_ref" + version_label = "version_label" + } +} +#Sample template for Datadog Metrics Health Source +resource "harness_platform_monitored_service" "example8" { + org_id = "org_id" + project_id = "project_id" + identifier = "identifier" + request { + name = "name" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "ddm" + identifier = "ddm" + type = "DatadogMetrics" + spec = jsonencode({ + connectorRef = "connectorRef" + feature = "Datadog Cloud Metrics" + metricDefinitions = [ + { + metricName = "metric" + metricPath = "M1" + identifier = "metric" + query = "avg:kubernetes.cpu.limits{*}.rollup(avg, 60);\navg:kubernetes.cpu.limits{*}.rollup(avg, 30);\n(a+b)/10" + isManualQuery = true + isCustomCreatedMetric = true + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + analysis = { + liveMonitoring = { + enabled = true + } + deploymentVerification = { + enabled = true + serviceInstanceFieldName = "pod" + } + } + sli : { + enabled = true + } + }, + { + metricName = "dashboard_metric_cpu" + identifier = "metric_cpu" + query = "avg:kubernetes.cpu.limits{*}.rollup(avg, 60);\navg:kubernetes.cpu.limits{*}.rollup(avg, 30);\n(a+b)/10" + isManualQuery = false + dashboardName = "dashboard" + metricPath = "M1" + groupingQuery = "avg:kubernetes.cpu.limits{*} by {host}.rollup(avg, 60)" + metric = "kubernetes.cpu.limits" + aggregation = "avg" + isCustomCreatedMetric = true + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + analysis = { + liveMonitoring = { + enabled = true + } + deploymentVerification = { + enabled = true + serviceInstanceFieldName = "pod" + } + } + sli : { + enabled = true + } + } + ] + }) } - template_ref = "template_ref" + template_ref = "template_ref" version_label = "version_label" } } \ No newline at end of file diff --git a/go.mod b/go.mod index 01b26a10d..e16e4ae9b 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/antihax/optional v1.0.0 github.com/docker/docker v24.0.5+incompatible - github.com/harness/harness-go-sdk v0.3.44 + github.com/harness/harness-go-sdk v0.3.46 github.com/harness/harness-openapi-go-client v0.0.18 github.com/hashicorp/go-cleanhttp v0.5.2 github.com/hashicorp/go-retryablehttp v0.7.4 @@ -17,10 +17,15 @@ require ( require ( github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect + github.com/Masterminds/goutils v1.1.1 // indirect + github.com/Masterminds/semver/v3 v3.1.1 // indirect + github.com/Masterminds/sprig/v3 v3.2.2 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect github.com/agext/levenshtein v1.2.3 // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect + github.com/armon/go-radix v1.0.0 // indirect + github.com/bgentry/speakeasy v0.1.0 // indirect github.com/cloudflare/circl v1.3.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect @@ -30,6 +35,7 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-cmp v0.5.9 // indirect + github.com/google/uuid v1.3.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect @@ -43,16 +49,20 @@ require ( github.com/hashicorp/logutils v1.0.0 // indirect github.com/hashicorp/terraform-exec v0.18.1 // indirect github.com/hashicorp/terraform-json v0.17.1 // indirect + github.com/hashicorp/terraform-plugin-docs v0.16.0 // indirect github.com/hashicorp/terraform-plugin-go v0.18.0 // indirect github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect github.com/hashicorp/terraform-registry-address v0.2.2 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect github.com/hashicorp/yamux v0.1.1 // indirect + github.com/huandu/xstrings v1.3.2 // indirect + github.com/imdario/mergo v0.3.13 // indirect github.com/jhump/protoreflect v1.6.1 // indirect github.com/jinzhu/copier v0.4.0 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mitchellh/cli v1.1.5 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect @@ -62,12 +72,17 @@ require ( github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc4 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/posener/complete v1.2.3 // indirect + github.com/russross/blackfriday v1.6.0 // indirect + github.com/shopspring/decimal v1.3.1 // indirect + github.com/spf13/cast v1.5.0 // indirect github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816 // indirect github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/zclconf/go-cty v1.13.2 // indirect golang.org/x/crypto v0.12.0 // indirect + golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect golang.org/x/mod v0.12.0 // indirect golang.org/x/net v0.14.0 // indirect golang.org/x/oauth2 v0.11.0 // indirect @@ -82,5 +97,6 @@ require ( gotest.tools/v3 v3.3.0 // indirect ) -// replace github.com/harness/harness-go-sdk => ../harness-go-sdk +//replace github.com/harness/harness-go-sdk => ../harness-go-sdk + // replace github.com/harness/harness-openapi-go-client => ../harness-openapi-go-client diff --git a/go.sum b/go.sum index 5435e1756..da69fd500 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,12 @@ github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= +github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= +github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= +github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/Masterminds/sprig/v3 v3.2.1/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= +github.com/Masterminds/sprig/v3 v3.2.2 h1:17jRggJu518dr3QaafizSXOjKYp94wKfABxUmyxvxX8= +github.com/Masterminds/sprig/v3 v3.2.2/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 h1:KLq8BE0KwCL+mmXnjLWEAOYO+2l2AE4YMmqG1ZpZHBs= @@ -12,6 +19,11 @@ github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kd github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= +github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= @@ -28,6 +40,7 @@ github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5Xh github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= @@ -46,8 +59,14 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/harness/harness-go-sdk v0.3.44 h1:DMcLBqtRiuQGeBT/cqx6jax4oe0NrDJ9Fbjspz7NNdM= github.com/harness/harness-go-sdk v0.3.44/go.mod h1:CPXydorp4zd5Dz2u2FXiHyWL4yd5PQafOMN69cgPSvk= +github.com/harness/harness-go-sdk v0.3.46 h1:zLtYMU3rkiANMbPblGM7tMFCrMriZPnVw3UNeod6GUk= +github.com/harness/harness-go-sdk v0.3.46/go.mod h1:CPXydorp4zd5Dz2u2FXiHyWL4yd5PQafOMN69cgPSvk= github.com/harness/harness-openapi-go-client v0.0.18 h1:gPhLOSOwjmZJ3aLjJiBbWPOMSBm8h72wbVSfx19eWZM= github.com/harness/harness-openapi-go-client v0.0.18/go.mod h1:u0vqYb994BJGotmEwJevF4L3BNAdU9i8ui2d22gmLPA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -63,6 +82,7 @@ github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBM github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-plugin v1.4.10 h1:xUbmA4jC6Dq163/fWcp8P3JuHilrHHMLNRxzGQJ9hNk= @@ -84,6 +104,8 @@ github.com/hashicorp/terraform-exec v0.18.1 h1:LAbfDvNQU1l0NOQlTuudjczVhHj061fNX github.com/hashicorp/terraform-exec v0.18.1/go.mod h1:58wg4IeuAJ6LVsLUeD2DWZZoc/bYi6dzhLHzxM41980= github.com/hashicorp/terraform-json v0.17.1 h1:eMfvh/uWggKmY7Pmb3T85u86E2EQg6EQHgyRwf3RkyA= github.com/hashicorp/terraform-json v0.17.1/go.mod h1:Huy6zt6euxaY9knPAFKjUITn8QxUFIe9VuSzb4zn/0o= +github.com/hashicorp/terraform-plugin-docs v0.16.0 h1:UmxFr3AScl6Wged84jndJIfFccGyBZn52KtMNsS12dI= +github.com/hashicorp/terraform-plugin-docs v0.16.0/go.mod h1:M3ZrlKBJAbPMtNOPwHicGi1c+hZUh7/g0ifT/z7TVfA= github.com/hashicorp/terraform-plugin-go v0.18.0 h1:IwTkOS9cOW1ehLd/rG0y+u/TGLK9y6fGoBjXVUquzpE= github.com/hashicorp/terraform-plugin-go v0.18.0/go.mod h1:l7VK+2u5Kf2y+A+742GX0ouLut3gttudmvMgN0PA74Y= github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= @@ -96,7 +118,12 @@ github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= +github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= +github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= +github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jhump/protoreflect v1.6.1 h1:4/2yi5LyDPP7nN+Hiird1SAJ6YoxUm13/oxHGRnbPd8= github.com/jhump/protoreflect v1.6.1/go.mod h1:RZQ/lnuN+zqeRVpQigTwO6o0AJUkxbnSnpuG7toUTG4= @@ -114,15 +141,20 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mitchellh/cli v1.1.5 h1:OxRIeJXpAMztws/XHlN2vu6imG5Dpq+j61AzAX5fLng= +github.com/mitchellh/cli v1.1.5/go.mod h1:v8+iFts2sPIKUV1ltktPXMCC8fumSKFItNcD2cLtRR4= +github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= @@ -131,6 +163,7 @@ github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQ github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA= @@ -148,19 +181,32 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= +github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= +github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= +github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= +github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/skeema/knownhosts v1.1.0 h1:Wvr9V0MxhjRbl3f9nMnKnFfiWTJmtECJ9Njkea3ysW0= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= +github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -185,12 +231,16 @@ github.com/zclconf/go-cty v1.13.2 h1:4GvrUxe/QUDYuJKAav4EYqdM47/kZa672LwmXFmEKT0 github.com/zclconf/go-cty v1.13.2/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= +golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME= +golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -287,7 +337,10 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.3.0 h1:MfDY1b1/0xN1CyMlQDac0ziEy9zJQd9CXBRRDHw2jJo= diff --git a/internal/service/platform/monitored_service/data_source_monitored_service_test.go b/internal/service/platform/monitored_service/data_source_monitored_service_test.go index b6b8d0a34..5c90d5ac7 100644 --- a/internal/service/platform/monitored_service/data_source_monitored_service_test.go +++ b/internal/service/platform/monitored_service/data_source_monitored_service_test.go @@ -11,16 +11,135 @@ import ( func TestAccDataSourceMonitoredService(t *testing.T) { - id := fmt.Sprintf("%s_%s", t.Name(), utils.RandStringBytes(6)) + id := fmt.Sprintf("%s_%s", t.Name(), utils.RandStringBytes(6)) //Add with muliptle logs and metrics name := id resourceName := "data.harness_platform_monitored_service.test" - resource.UnitTest(t, resource.TestCase{ PreCheck: func() { acctest.TestAccPreCheck(t) }, ProviderFactories: acctest.ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccDataSourceMonitoredService(id, name), + Config: testAccELKDataSourceMonitoredService(id, name), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "identifier", id), + resource.TestCheckResourceAttr(resourceName, "org_id", id), + resource.TestCheckResourceAttr(resourceName, "project_id", id), + ), + }, + }, + }) + id = fmt.Sprintf("%s_%s", t.Name(), utils.RandStringBytes(6)) + resource.UnitTest(t, resource.TestCase{ + PreCheck: func() { acctest.TestAccPreCheck(t) }, + ProviderFactories: acctest.ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testAccSumologicMetricDataSourceMonitoredService(id, name), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "identifier", id), + resource.TestCheckResourceAttr(resourceName, "org_id", id), + resource.TestCheckResourceAttr(resourceName, "project_id", id), + ), + }, + }, + }) + id = fmt.Sprintf("%s_%s", t.Name(), utils.RandStringBytes(6)) + resource.UnitTest(t, resource.TestCase{ + PreCheck: func() { acctest.TestAccPreCheck(t) }, + ProviderFactories: acctest.ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testAccSumologicLogDataSourceMonitoredService(id, name), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "identifier", id), + resource.TestCheckResourceAttr(resourceName, "org_id", id), + resource.TestCheckResourceAttr(resourceName, "project_id", id), + ), + }, + }, + }) + id = fmt.Sprintf("%s_%s", t.Name(), utils.RandStringBytes(6)) + resource.UnitTest(t, resource.TestCase{ + PreCheck: func() { acctest.TestAccPreCheck(t) }, + ProviderFactories: acctest.ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testAccSplunkSignalFXDataSourceMonitoredService(id, name), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "identifier", id), + resource.TestCheckResourceAttr(resourceName, "org_id", id), + resource.TestCheckResourceAttr(resourceName, "project_id", id), + ), + }, + }, + }) + id = fmt.Sprintf("%s_%s", t.Name(), utils.RandStringBytes(6)) + resource.UnitTest(t, resource.TestCase{ + PreCheck: func() { acctest.TestAccPreCheck(t) }, + ProviderFactories: acctest.ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testAccGrafanaLokiLogsDataSourceMonitoredService(id, name), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "identifier", id), + resource.TestCheckResourceAttr(resourceName, "org_id", id), + resource.TestCheckResourceAttr(resourceName, "project_id", id), + ), + }, + }, + }) + id = fmt.Sprintf("%s_%s", t.Name(), utils.RandStringBytes(6)) + resource.UnitTest(t, resource.TestCase{ + PreCheck: func() { acctest.TestAccPreCheck(t) }, + ProviderFactories: acctest.ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testAccAzureMetricsDataSourceMonitoredService(id, name), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "identifier", id), + resource.TestCheckResourceAttr(resourceName, "org_id", id), + resource.TestCheckResourceAttr(resourceName, "project_id", id), + ), + }, + }, + }) + id = fmt.Sprintf("%s_%s", t.Name(), utils.RandStringBytes(6)) + resource.UnitTest(t, resource.TestCase{ + PreCheck: func() { acctest.TestAccPreCheck(t) }, + ProviderFactories: acctest.ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testAccAzureLogsDataSourceMonitoredService(id, name), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "identifier", id), + resource.TestCheckResourceAttr(resourceName, "org_id", id), + resource.TestCheckResourceAttr(resourceName, "project_id", id), + ), + }, + }, + }) + id = fmt.Sprintf("%s_%s", t.Name(), utils.RandStringBytes(6)) + resource.UnitTest(t, resource.TestCase{ + PreCheck: func() { acctest.TestAccPreCheck(t) }, + ProviderFactories: acctest.ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testAccPrometheusMetricsDataSourceMonitoredService(id, name), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "identifier", id), + resource.TestCheckResourceAttr(resourceName, "org_id", id), + resource.TestCheckResourceAttr(resourceName, "project_id", id), + ), + }, + }, + }) + id = fmt.Sprintf("%s_%s", t.Name(), utils.RandStringBytes(6)) + resource.UnitTest(t, resource.TestCase{ + PreCheck: func() { acctest.TestAccPreCheck(t) }, + ProviderFactories: acctest.ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testAccDatadogMetricsDataSourceMonitoredService(id, name), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "identifier", id), resource.TestCheckResourceAttr(resourceName, "org_id", id), @@ -31,8 +150,9 @@ func TestAccDataSourceMonitoredService(t *testing.T) { }) } -func testAccDataSourceMonitoredService(id string, name string) string { - return fmt.Sprintf(` +func testAccELKDataSourceMonitoredService(id string, name string) string { + return fmt.Sprintf( + ` resource "harness_platform_organization" "test" { identifier = "%[1]s" name = "%[2]s" @@ -60,27 +180,463 @@ func testAccDataSourceMonitoredService(id string, name string) string { name = "name" identifier = "identifier" type = "ElasticSearch" + version = "v2" spec = jsonencode({ connectorRef = "connectorRef" - feature = "feature" - queries = [ + queryDefinitions = [ { - name = "name" + name = "name" + identifier = "identifier" query = "query" - index = "index" - serviceInstanceIdentifier = "serviceInstanceIdentifier" - timeStampIdentifier = "timeStampIdentifier" - timeStampFormat = "timeStampFormat" - messageIdentifier = "messageIdentifier" + groupName = "Logs Group" + queryParams = { + index = "index" + serviceInstanceField = "serviceInstanceIdentifier" + timeStampIdentifier = "timeStampIdentifier" + timeStampFormat = "timeStampFormat" + messageIdentifier = "messageIdentifier" + } + }, + { + name = "name2" + identifier = "identifier2" + groupName = "Logs Group" + query = "query" + queryParams = { + index = "index" + serviceInstanceField = "serviceInstanceIdentifier" + timeStampIdentifier = "timeStampIdentifier" + timeStampFormat = "timeStampFormat" + messageIdentifier = "messageIdentifier" + } + } + ]}) + } + change_sources { + name = "csName1" + identifier = "harness_cd_next_gen" + type = "HarnessCDNextGen" + enabled = true + spec = jsonencode({ + }) + category = "Deployment" + } + template_ref = "template_ref" + version_label = "version_label" + } + } + + data "harness_platform_monitored_service" "test" { + identifier = harness_platform_monitored_service.test.identifier + org_id = harness_platform_organization.test.id + project_id = harness_platform_project.test.id + }`, + id, name) +} + +func testAccSumologicMetricDataSourceMonitoredService(id string, name string) string { + return fmt.Sprintf( + ` + resource "harness_platform_organization" "test" { + identifier = "%[1]s" + name = "%[2]s" + } + + resource "harness_platform_project" "test" { + identifier = "%[1]s" + name = "%[2]s" + org_id = harness_platform_organization.test.id + color = "#472848" + } + + resource "harness_platform_monitored_service" "test" { + org_id = harness_platform_organization.test.id + project_id = harness_platform_project.test.id + identifier = "%[1]s" + request { + name = "%[2]s" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "sumologicmetrics" + identifier = "sumo_metric_identifier" + type = "SumologicMetrics" + version = "v2" + spec = jsonencode({ + connectorRef = "connectorRef" + queryDefinitions = [ + { + name = "metric_cpu" + identifier = "metric_cpu" + query = "metric=cpu" + groupName = "g1" + queryParams = { + } + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + liveMonitoringEnabled = "true" + continuousVerificationEnabled = "true" + sliEnabled = "false" + }, + { + name = "name2" + identifier = "identifier2" + groupName = "g2" + query = "metric=memory" + queryParams = { + } + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + liveMonitoringEnabled = "false" + continuousVerificationEnabled = "false" + sliEnabled = "false" + } + ]}) + } + change_sources { + name = "csName1" + identifier = "harness_cd_next_gen" + type = "HarnessCDNextGen" + enabled = true + spec = jsonencode({ + }) + category = "Deployment" + } + template_ref = "template_ref" + version_label = "version_label" + } + } + + data "harness_platform_monitored_service" "test" { + identifier = harness_platform_monitored_service.test.identifier + org_id = harness_platform_organization.test.id + project_id = harness_platform_project.test.id + }`, + id, name) +} + +func testAccSumologicLogDataSourceMonitoredService(id string, name string) string { + return fmt.Sprintf( + ` + resource "harness_platform_organization" "test" { + identifier = "%[1]s" + name = "%[2]s" + } + + resource "harness_platform_project" "test" { + identifier = "%[1]s" + name = "%[2]s" + org_id = harness_platform_organization.test.id + color = "#472848" + } + + resource "harness_platform_monitored_service" "test" { + org_id = harness_platform_organization.test.id + project_id = harness_platform_project.test.id + identifier = "%[1]s" + request { + name = "%[2]s" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "sumologic" + identifier = "sumo_metric_identifier" + type = "SumologicLogs" + version = "v2" + spec = jsonencode({ + connectorRef = "connectorRef" + queryDefinitions = [ + { + name = "log1" + identifier = "log1" + query = "*" + groupName = "Logs Group" + queryParams = { + serviceInstanceField = "_sourcehost" + } + }, + { + name = "log2" + identifier = "identifier2" + groupName = "g2" + query = "error" + queryParams = { + serviceInstanceField = "_sourcehost" + } + } + ]}) + } + change_sources { + name = "csName1" + identifier = "harness_cd_next_gen" + type = "HarnessCDNextGen" + enabled = true + spec = jsonencode({ + }) + category = "Deployment" + } + template_ref = "template_ref" + version_label = "version_label" + } + } + + data "harness_platform_monitored_service" "test" { + identifier = harness_platform_monitored_service.test.identifier + org_id = harness_platform_organization.test.id + project_id = harness_platform_project.test.id + }`, + id, name) +} + +func testAccSplunkSignalFXDataSourceMonitoredService(id string, name string) string { + return fmt.Sprintf( + ` + resource "harness_platform_organization" "test" { + identifier = "%[1]s" + name = "%[2]s" + } + + resource "harness_platform_project" "test" { + identifier = "%[1]s" + name = "%[2]s" + org_id = harness_platform_organization.test.id + color = "#472848" + } + + resource "harness_platform_monitored_service" "test" { + org_id = harness_platform_organization.test.id + project_id = harness_platform_project.test.id + identifier = "%[1]s" + request { + name = "%[2]s" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "signalfxmetrics" + identifier = "signalfxmetrics" + type = "SplunkSignalFXMetrics" + version = "v2" + spec = jsonencode({ + connectorRef = "connectorRef" + queryDefinitions = [ + { + name = "metric_infra_cpu" + identifier = "metric_infra_cpu" + query = "***" + groupName = "g" + riskProfile = { + riskCategory = "Errors" + thresholdTypes = [ + "ACT_WHEN_HIGHER", + "ACT_WHEN_LOWER" + ] + } + liveMonitoringEnabled = "true" + continuousVerificationEnabled = "true" + sliEnabled = "false" + }, + { + name = "name2" + identifier = "identifier2" + groupName = "g2" + query = "*" + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + liveMonitoringEnabled = "true" + continuousVerificationEnabled = "false" + sliEnabled = "false" + } + ]}) + } + change_sources { + name = "csName1" + identifier = "harness_cd_next_gen" + type = "HarnessCDNextGen" + enabled = true + spec = jsonencode({ + }) + category = "Deployment" + } + template_ref = "template_ref" + version_label = "version_label" + } + } + + data "harness_platform_monitored_service" "test" { + identifier = harness_platform_monitored_service.test.identifier + org_id = harness_platform_organization.test.id + project_id = harness_platform_project.test.id + }`, + id, name) +} + +func testAccGrafanaLokiLogsDataSourceMonitoredService(id string, name string) string { + return fmt.Sprintf( + ` + resource "harness_platform_organization" "test" { + identifier = "%[1]s" + name = "%[2]s" + } + + resource "harness_platform_project" "test" { + identifier = "%[1]s" + name = "%[2]s" + org_id = harness_platform_organization.test.id + color = "#472848" + } + + resource "harness_platform_monitored_service" "test" { + org_id = harness_platform_organization.test.id + project_id = harness_platform_project.test.id + identifier = "%[1]s" + request { + name = "%[2]s" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "Test" + identifier = "Test" + type = "GrafanaLokiLogs" + version = "v2" + spec = jsonencode({ + connectorRef = "connectorRef" + queryDefinitions = [ + { + name = "Demo" + identifier = "Demo" + query = "{job=~\".+\"}" + groupName = "Log_Group" + queryParams = { + serviceInstanceField = "job" + } + }, + { + name = "log2" + identifier = "identifier2" + groupName = "g2" + query = "error" + queryParams = { + serviceInstanceField = "_sourcehost" + } + liveMonitoringEnabled = "false" + continuousVerificationEnabled = "false" + sliEnabled = "false" + } + ]}) + } + template_ref = "template_ref" + version_label = "version_label" + } + } + + data "harness_platform_monitored_service" "test" { + identifier = harness_platform_monitored_service.test.identifier + org_id = harness_platform_organization.test.id + project_id = harness_platform_project.test.id + }`, + id, name) +} + +func testAccAzureMetricsDataSourceMonitoredService(id string, name string) string { + return fmt.Sprintf( + ` + resource "harness_platform_organization" "test" { + identifier = "%[1]s" + name = "%[2]s" + } + + resource "harness_platform_project" "test" { + identifier = "%[1]s" + name = "%[2]s" + org_id = harness_platform_organization.test.id + color = "#472848" + } + + resource "harness_platform_monitored_service" "test" { + org_id = harness_platform_organization.test.id + project_id = harness_platform_project.test.id + identifier = "%[1]s" + request { + name = "%[2]s" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "azure metrics verify step" + identifier = "azure_metrics_verify_step" + type = "AzureMetrics" + version = "v2" + spec = jsonencode({ + connectorRef = "connectorRef" + queryDefinitions = [ + { + name = "metric" + identifier = "metric" + query = "default" + groupName = "g1" + queryParams = { + serviceInstanceField = "host" + index = "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test", + healthSourceMetricName = "cpuUsagePercentage", + healthSourceMetricNamespace = "insights.container/nodes", + aggregationType = "average" + } + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + liveMonitoringEnabled = "true" + continuousVerificationEnabled = "true" + sliEnabled = "false" }, { - name = "name2" - query = "query2" - index = "index2" - serviceInstanceIdentifier = "serviceInstanceIdentifier2" - timeStampIdentifier = "timeStampIdentifier2" - timeStampFormat = "timeStampFormat2" - messageIdentifier = "messageIdentifier2" + name = "name2" + identifier = "identifier2" + groupName = "g2" + queryParams = { + serviceInstanceField = "host" + index = "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test", + healthSourceMetricName = "cpuUsagePercentage", + healthSourceMetricNamespace = "insights.container/nodes", + aggregationType = "average" + } + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + liveMonitoringEnabled = "false" + continuousVerificationEnabled = "false" + sliEnabled = "false" } ]}) } @@ -102,6 +658,257 @@ func testAccDataSourceMonitoredService(id string, name string) string { identifier = harness_platform_monitored_service.test.identifier org_id = harness_platform_organization.test.id project_id = harness_platform_project.test.id + }`, + id, name) +} + +func testAccAzureLogsDataSourceMonitoredService(id string, name string) string { + return fmt.Sprintf( + ` + resource "harness_platform_organization" "test" { + identifier = "%[1]s" + name = "%[2]s" } -`, id, name) + + resource "harness_platform_project" "test" { + identifier = "%[1]s" + name = "%[2]s" + org_id = harness_platform_organization.test.id + color = "#472848" + } + + resource "harness_platform_monitored_service" "test" { + org_id = harness_platform_organization.test.id + project_id = harness_platform_project.test.id + identifier = "%[1]s" + request { + name = "%[2]s" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = [] + health_sources { + name = "Demo azure" + identifier = "Demo_azure" + type = "AzureLogs" + version = "v2" + spec = jsonencode({ + connectorRef = "connectorRef" + queryDefinitions = [ + { + name = "name2" + identifier = "identifier2" + groupName = "g2" + query = "*" + queryParams = { + serviceInstanceField = "Name", + timeStampIdentifier = "StartedTime", + messageIdentifier = "Image", + index = "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test" + } + liveMonitoringEnabled = "false" + continuousVerificationEnabled = "false" + } + ]}) + } + change_sources { + name = "csName1" + identifier = "harness_cd_next_gen" + type = "HarnessCDNextGen" + enabled = true + spec = jsonencode({ + }) + category = "Deployment" + } + template_ref = "template_ref" + version_label = "version_label" + } + } + + data "harness_platform_monitored_service" "test" { + identifier = harness_platform_monitored_service.test.identifier + org_id = harness_platform_organization.test.id + project_id = harness_platform_project.test.id + }`, + id, name) +} + +func testAccPrometheusMetricsDataSourceMonitoredService(id string, name string) string { + return fmt.Sprintf( + ` + resource "harness_platform_organization" "test" { + identifier = "%[1]s" + name = "%[2]s" + } + + resource "harness_platform_project" "test" { + identifier = "%[1]s" + name = "%[2]s" + org_id = harness_platform_organization.test.id + color = "#472848" + } + +resource "harness_platform_monitored_service" "test" { + org_id = harness_platform_organization.test.id + project_id = harness_platform_project.test.id + identifier = "%[1]s" + request { + name = "%[2]s" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "prometheus metrics verify step" + identifier = "prometheus_metrics" + type = "Prometheus" + spec = jsonencode({ + connectorRef = "connectorRef" + metricDefinitions = [ + { + identifier = "Prometheus_Metric", + metricName = "Prometheus Metric", + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + analysis = { + liveMonitoring = { + enabled = true + } + deploymentVerification = { + enabled = true + } + } + sli : { + enabled = true + } + query = "count(up{group=\"cv\",group=\"cv\"})" + groupName = "met" + serviceInstanceFieldName = "pod_name" + isManualQuery = true + } + ] + }) + } + template_ref = "template_ref" + version_label = "version_label" + } +} + + data "harness_platform_monitored_service" "test" { + identifier = harness_platform_monitored_service.test.identifier + org_id = harness_platform_organization.test.id + project_id = harness_platform_project.test.id + }`, + id, name) +} + +func testAccDatadogMetricsDataSourceMonitoredService(id string, name string) string { + return fmt.Sprintf( + ` + resource "harness_platform_organization" "test" { + identifier = "%[1]s" + name = "%[2]s" + } + + resource "harness_platform_project" "test" { + identifier = "%[1]s" + name = "%[2]s" + org_id = harness_platform_organization.test.id + color = "#472848" + } + +resource "harness_platform_monitored_service" "test" { + org_id = harness_platform_organization.test.id + project_id = harness_platform_project.test.id + identifier = "%[1]s" + request { + name = "%[2]s" + type = "Application" + description = "description" + service_ref = "service_ref" + environment_ref = "environment_ref" + tags = ["foo:bar", "bar:foo"] + health_sources { + name = "ddm" + identifier = "ddm" + type = "DatadogMetrics" + spec = jsonencode({ + connectorRef = "connectorRef" + feature = "Datadog Cloud Metrics" + metricDefinitions = [ + { + metricName = "metric" + identifier = "metric" + query = "avg:kubernetes.cpu.limits{*}.rollup(avg, 60);\navg:kubernetes.cpu.limits{*}.rollup(avg, 30);\n(a+b)/10" + isManualQuery = true + isCustomCreatedMetric = true + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + analysis = { + liveMonitoring = { + enabled = true + } + deploymentVerification = { + enabled = true + serviceInstanceFieldName = "group" + } + } + sli : { + enabled = true + } + }, + { + metricName = "dashboard_metric_cpu" + identifier = "metric_cpu" + query = "avg:kubernetes.cpu.limits{*}.rollup(avg, 60);\navg:kubernetes.cpu.limits{*}.rollup(avg, 30);\n(a+b)/10" + isManualQuery = false + dashboardName = "dashboard" + metricPath = "M1" + groupingQuery = "avg:kubernetes.cpu.limits{*} by {host}.rollup(avg, 60)" + metric = "kubernetes.cpu.limits" + aggregation = "avg" + isCustomCreatedMetric = true + riskProfile = { + riskCategory = "Performance_Other" + thresholdTypes = [ + "ACT_WHEN_HIGHER" + ] + } + analysis = { + liveMonitoring = { + enabled = true + } + deploymentVerification = { + enabled = true + serviceInstanceFieldName = "group" + } + } + sli : { + enabled = true + } + } + ] + }) + } + template_ref = "template_ref" + version_label = "version_label" + } +} + + data "harness_platform_monitored_service" "test" { + identifier = harness_platform_monitored_service.test.identifier + org_id = harness_platform_organization.test.id + project_id = harness_platform_project.test.id + }`, + id, name) } diff --git a/internal/service/platform/monitored_service/resource_monitored_service.go b/internal/service/platform/monitored_service/resource_monitored_service.go index a3f595805..66576ef11 100644 --- a/internal/service/platform/monitored_service/resource_monitored_service.go +++ b/internal/service/platform/monitored_service/resource_monitored_service.go @@ -106,6 +106,11 @@ func ResourceMonitoredService() *schema.Resource { Type: schema.TypeString, Required: true, }, + "version": { + Description: "Version of the health source.", + Type: schema.TypeString, + Optional: true, + }, "spec": { Description: "Specification of the health source. Depends on the type of the health source.", Type: schema.TypeString, @@ -312,35 +317,35 @@ func resourceMonitoredServiceDelete(ctx context.Context, d *schema.ResourceData, } func buildMonitoredServiceRequest(d *schema.ResourceData) *nextgen.MonitoredServiceDto { - monitoredServiceDto := &nextgen.MonitoredServiceDto{} + monitoredService := &nextgen.MonitoredServiceDto{} if attr, ok := d.GetOk("org_id"); ok { - monitoredServiceDto.OrgIdentifier = attr.(string) + monitoredService.OrgIdentifier = attr.(string) } if attr, ok := d.GetOk("project_id"); ok { - monitoredServiceDto.ProjectIdentifier = attr.(string) + monitoredService.ProjectIdentifier = attr.(string) } if attr, ok := d.GetOk("identifier"); ok { - monitoredServiceDto.Identifier = attr.(string) + monitoredService.Identifier = attr.(string) } if attr, ok := d.GetOk("request"); ok { request := attr.([]interface{})[0].(map[string]interface{}) - monitoredServiceDto.Name = request["name"].(string) - monitoredServiceDto.Type_ = request["type"].(string) - monitoredServiceDto.Description = request["description"].(string) - monitoredServiceDto.ServiceRef = request["service_ref"].(string) - monitoredServiceDto.EnvironmentRef = request["environment_ref"].(string) + monitoredService.Name = request["name"].(string) + monitoredService.Type_ = request["type"].(string) + monitoredService.Description = request["description"].(string) + monitoredService.ServiceRef = request["service_ref"].(string) + monitoredService.EnvironmentRef = request["environment_ref"].(string) environmentRefListReq := request["environment_ref_list"].([]interface{}) environmentRefList := make([]string, len(environmentRefListReq)) for i, environmentRef := range environmentRefListReq { environmentRefList[i] = environmentRef.(string) } - monitoredServiceDto.EnvironmentRefList = environmentRefList + monitoredService.EnvironmentRefList = environmentRefList tags := map[string]string{} for _, t := range request["tags"].(*schema.Set).List() { @@ -348,7 +353,7 @@ func buildMonitoredServiceRequest(d *schema.ResourceData) *nextgen.MonitoredServ parts := strings.Split(tagStr, ":") tags[parts[0]] = parts[1] } - monitoredServiceDto.Tags = tags + monitoredService.Tags = tags healthSources := request["health_sources"].(*schema.Set).List() hss := make([]nextgen.HealthSource, len(healthSources)) @@ -366,7 +371,7 @@ func buildMonitoredServiceRequest(d *schema.ResourceData) *nextgen.MonitoredServ csDto[i] = changeSourceDto } - monitoredServiceDto.Sources = &nextgen.Sources{ + monitoredService.Sources = &nextgen.Sources{ HealthSources: hss, ChangeSources: csDto, } @@ -378,7 +383,7 @@ func buildMonitoredServiceRequest(d *schema.ResourceData) *nextgen.MonitoredServ serviceDependency := getServiceDependencyByType(sd) serviceDependencyDto[i] = serviceDependency } - monitoredServiceDto.Dependencies = serviceDependencyDto + monitoredService.Dependencies = serviceDependencyDto notificationRuleRefsReq := request["notification_rule_refs"].([]interface{}) notificationRuleRefs := make([]nextgen.NotificationRuleRefDto, len(notificationRuleRefsReq)) @@ -386,29 +391,28 @@ func buildMonitoredServiceRequest(d *schema.ResourceData) *nextgen.MonitoredServ test := notificationRuleRef.(map[string]interface{}) notificationRuleRefDto := &nextgen.NotificationRuleRefDto{ NotificationRuleRef: test["notification_rule_ref"].(string), - Enabled: test["enabled"].(bool), + Enabled: test["enabled"].(bool), } notificationRuleRefs[i] = *notificationRuleRefDto } - monitoredServiceDto.NotificationRuleRefs = notificationRuleRefs + monitoredService.NotificationRuleRefs = notificationRuleRefs - monitoredServiceDto.Template = &nextgen.TemplateDto{ - TemplateRef: request["template_ref"].(string), + monitoredService.Template = &nextgen.TemplateDto{ + TemplateRef: request["template_ref"].(string), VersionLabel: request["version_label"].(string), } } - return monitoredServiceDto + return monitoredService } func readMonitoredService(d *schema.ResourceData, monitoredServiceResponse **nextgen.MonitoredServiceResponse) { - monitoredServiceDto := &(*monitoredServiceResponse).MonitoredService + monitoredService := &(*monitoredServiceResponse).MonitoredService - d.SetId((*monitoredServiceDto).Identifier) + d.SetId((*monitoredService).Identifier) - d.Set("org_id", (*monitoredServiceDto).OrgIdentifier) - d.Set("project_id", (*monitoredServiceDto).ProjectIdentifier) - d.Set("identifier", (*monitoredServiceDto).Identifier) + d.Set("org_id", (*monitoredService).OrgIdentifier) + d.Set("project_id", (*monitoredService).ProjectIdentifier) + d.Set("identifier", (*monitoredService).Identifier) } - diff --git a/internal/service/platform/monitored_service/resource_monitored_service_test.go b/internal/service/platform/monitored_service/resource_monitored_service_test.go index e6524df13..094446405 100644 --- a/internal/service/platform/monitored_service/resource_monitored_service_test.go +++ b/internal/service/platform/monitored_service/resource_monitored_service_test.go @@ -76,7 +76,7 @@ func TestAccResourceMonitoredService(t *testing.T) { }) }*/ -func testAccGetMonitoredService(resourceName string, state *terraform.State) (*nextgen.MonitoredServiceDto, error) { +func testAccGetMonitoredService(resourceName string, state *terraform.State) (*nextgen.MonitoredService, error) { r := acctest.TestAccGetResource(resourceName, state) c, ctx := acctest.TestAccGetPlatformClientWithContext() id := r.Primary.ID @@ -320,4 +320,3 @@ func testMonitoredServiceWithoutEnabled(id string, name string) string { } `, id, name) } - diff --git a/internal/service/platform/monitored_service/utils.go b/internal/service/platform/monitored_service/utils.go index f84221394..507bcb1f6 100644 --- a/internal/service/platform/monitored_service/utils.go +++ b/internal/service/platform/monitored_service/utils.go @@ -8,174 +8,272 @@ import ( func getHealthSourceByType(hs map[string]interface{}) nextgen.HealthSource { healthSourceType := hs["type"].(string) - healthSourceSpec := hs["spec"].(string) + healthSource := hs["spec"].(string) if healthSourceType == "AppDynamics" { - data := nextgen.AppDynamicsHealthSourceSpec{} - json.Unmarshal([]byte(healthSourceSpec), &data) + data := nextgen.AppDynamicsHealthSource{} + json.Unmarshal([]byte(healthSource), &data) return nextgen.HealthSource{ - Name: hs["name"].(string), - Identifier: hs["identifier"].(string), - Type_: nextgen.HealthSourceType(healthSourceType), + Name: hs["name"].(string), + Identifier: hs["identifier"].(string), + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), AppDynamics: &data, } } if healthSourceType == "NewRelic" { - data := nextgen.NewRelicHealthSourceSpec{} - json.Unmarshal([]byte(healthSourceSpec), &data) + data := nextgen.NewRelicHealthSource{} + json.Unmarshal([]byte(healthSource), &data) return nextgen.HealthSource{ - Name: hs["name"].(string), - Identifier: hs["identifier"].(string), - Type_: nextgen.HealthSourceType(healthSourceType), - NewRelic: &data, + Name: hs["name"].(string), + Identifier: hs["identifier"].(string), + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), + NewRelic: &data, } } if healthSourceType == "StackdriverLog" { - data := nextgen.StackdriverLogHealthSourceSpec{} - json.Unmarshal([]byte(healthSourceSpec), &data) + data := nextgen.StackdriverLogHealthSource{} + json.Unmarshal([]byte(healthSource), &data) return nextgen.HealthSource{ - Name: hs["name"].(string), - Identifier: hs["identifier"].(string), - Type_: nextgen.HealthSourceType(healthSourceType), + Name: hs["name"].(string), + Identifier: hs["identifier"].(string), + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), StackdriverLog: &data, } } if healthSourceType == "Splunk" { - data := nextgen.SplunkHealthSourceSpec{} - json.Unmarshal([]byte(healthSourceSpec), &data) + data := nextgen.SplunkHealthSource{} + json.Unmarshal([]byte(healthSource), &data) return nextgen.HealthSource{ - Name: hs["name"].(string), - Identifier: hs["identifier"].(string), - Type_: nextgen.HealthSourceType(healthSourceType), - Splunk: &data, + Name: hs["name"].(string), + Identifier: hs["identifier"].(string), + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), + Splunk: &data, } } if healthSourceType == "Prometheus" { - data := nextgen.PrometheusHealthSourceSpec{} - json.Unmarshal([]byte(healthSourceSpec), &data) + data := nextgen.PrometheusHealthSource{} + json.Unmarshal([]byte(healthSource), &data) return nextgen.HealthSource{ - Name: hs["name"].(string), - Identifier: hs["identifier"].(string), - Type_: nextgen.HealthSourceType(healthSourceType), + Name: hs["name"].(string), + Identifier: hs["identifier"].(string), + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), Prometheus: &data, } } if healthSourceType == "Stackdriver" { - data := nextgen.StackdriverMetricHealthSourceSpec{} - json.Unmarshal([]byte(healthSourceSpec), &data) + data := nextgen.StackdriverMetricHealthSource{} + json.Unmarshal([]byte(healthSource), &data) return nextgen.HealthSource{ - Name: hs["name"].(string), - Identifier: hs["identifier"].(string), - Type_: nextgen.HealthSourceType(healthSourceType), + Name: hs["name"].(string), + Identifier: hs["identifier"].(string), + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), Stackdriver: &data, } } if healthSourceType == "DatadogMetrics" { - data := nextgen.DatadogMetricHealthSourceSpec{} - json.Unmarshal([]byte(healthSourceSpec), &data) + data := nextgen.DatadogMetricHealthSource{} + json.Unmarshal([]byte(healthSource), &data) return nextgen.HealthSource{ - Name: hs["name"].(string), - Identifier: hs["identifier"].(string), - Type_: nextgen.HealthSourceType(healthSourceType), + Name: hs["name"].(string), + Identifier: hs["identifier"].(string), + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), DatadogMetrics: &data, } } if healthSourceType == "DatadogLog" { - data := nextgen.DatadogLogHealthSourceSpec{} - json.Unmarshal([]byte(healthSourceSpec), &data) + data := nextgen.DatadogLogHealthSource{} + json.Unmarshal([]byte(healthSource), &data) return nextgen.HealthSource{ - Name: hs["name"].(string), - Identifier: hs["identifier"].(string), - Type_: nextgen.HealthSourceType(healthSourceType), + Name: hs["name"].(string), + Identifier: hs["identifier"].(string), + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), DatadogLog: &data, } } if healthSourceType == "Dynatrace" { - data := nextgen.DynatraceHealthSourceSpec{} - json.Unmarshal([]byte(healthSourceSpec), &data) + data := nextgen.DynatraceHealthSource{} + json.Unmarshal([]byte(healthSource), &data) return nextgen.HealthSource{ - Name: hs["name"].(string), - Identifier: hs["identifier"].(string), - Type_: nextgen.HealthSourceType(healthSourceType), - Dynatrace: &data, + Name: hs["name"].(string), + Identifier: hs["identifier"].(string), + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), + Dynatrace: &data, } } if healthSourceType == "ErrorTracking" { - data := nextgen.ErrorTrackingHealthSourceSpec{} - json.Unmarshal([]byte(healthSourceSpec), &data) + data := nextgen.ErrorTrackingHealthSource{} + json.Unmarshal([]byte(healthSource), &data) return nextgen.HealthSource{ Name: hs["name"].(string), Identifier: hs["identifier"].(string), - Type_: nextgen.HealthSourceType(healthSourceType), + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), ErrorTracking: &data, } } if healthSourceType == "CustomHealthMetric" { - data := nextgen.CustomHealthSourceMetricSpec{} - json.Unmarshal([]byte(healthSourceSpec), &data) + data := nextgen.CustomHealthSourceMetric{} + json.Unmarshal([]byte(healthSource), &data) return nextgen.HealthSource{ - Name: hs["name"].(string), - Identifier: hs["identifier"].(string), - Type_: nextgen.HealthSourceType(healthSourceType), + Name: hs["name"].(string), + Identifier: hs["identifier"].(string), + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), CustomHealthMetric: &data, } } if healthSourceType == "CustomHealthLog" { - data := nextgen.CustomHealthSourceLogSpec{} - json.Unmarshal([]byte(healthSourceSpec), &data) + data := nextgen.CustomHealthSourceLog{} + json.Unmarshal([]byte(healthSource), &data) return nextgen.HealthSource{ - Name: hs["name"].(string), - Identifier: hs["identifier"].(string), - Type_: nextgen.HealthSourceType(healthSourceType), + Name: hs["name"].(string), + Identifier: hs["identifier"].(string), + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), CustomHealthLog: &data, } } if healthSourceType == "SplunkMetric" { - data := nextgen.SplunkMetricHealthSourceSpec{} - json.Unmarshal([]byte(healthSourceSpec), &data) + data := nextgen.SplunkMetricHealthSource{} + json.Unmarshal([]byte(healthSource), &data) return nextgen.HealthSource{ - Name: hs["name"].(string), - Identifier: hs["identifier"].(string), - Type_: nextgen.HealthSourceType(healthSourceType), + Name: hs["name"].(string), + Identifier: hs["identifier"].(string), + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), SplunkMetric: &data, } } if healthSourceType == "ElasticSearch" { - data := nextgen.ElkHealthSourceSpec{} - json.Unmarshal([]byte(healthSourceSpec), &data) + data := nextgen.NextGenHealthSource{} + json.Unmarshal([]byte(healthSource), &data) return nextgen.HealthSource{ Name: hs["name"].(string), Identifier: hs["identifier"].(string), - Type_: nextgen.HealthSourceType(healthSourceType), + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), ElasticSearch: &data, } } if healthSourceType == "CloudWatchMetrics" { - data := nextgen.CloudWatchMetricsHealthSourceSpec{} - json.Unmarshal([]byte(healthSourceSpec), &data) + data := nextgen.CloudWatchMetricsHealthSource{} + json.Unmarshal([]byte(healthSource), &data) + + return nextgen.HealthSource{ + Name: hs["name"].(string), + Identifier: hs["identifier"].(string), + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), + CloudWatchMetrics: &data, + } + } + if healthSourceType == "AwsPrometheus" { + data := nextgen.AwsPrometheusHealthSource{} + json.Unmarshal([]byte(healthSource), &data) return nextgen.HealthSource{ Name: hs["name"].(string), Identifier: hs["identifier"].(string), - Type_: nextgen.HealthSourceType(healthSourceType), - CloudWatchMetrics: &data, + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), + AwsPrometheus: &data, + } + } + if healthSourceType == "SumologicMetrics" { + data := nextgen.NextGenHealthSource{} + json.Unmarshal([]byte(healthSource), &data) + + return nextgen.HealthSource{ + Name: hs["name"].(string), + Identifier: hs["identifier"].(string), + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), + SumologicMetrics: &data, + } + } + if healthSourceType == "SumologicLogs" { + data := nextgen.NextGenHealthSource{} + json.Unmarshal([]byte(healthSource), &data) + + return nextgen.HealthSource{ + Name: hs["name"].(string), + Identifier: hs["identifier"].(string), + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), + SumologicLogs: &data, } } + if healthSourceType == "SplunkSignalFXMetrics" { + data := nextgen.NextGenHealthSource{} + json.Unmarshal([]byte(healthSource), &data) + return nextgen.HealthSource{ + Name: hs["name"].(string), + Identifier: hs["identifier"].(string), + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), + SplunkSignalFXMetrics: &data, + } + } + if healthSourceType == "GrafanaLokiLogs" { + data := nextgen.NextGenHealthSource{} + json.Unmarshal([]byte(healthSource), &data) + + return nextgen.HealthSource{ + Name: hs["name"].(string), + Identifier: hs["identifier"].(string), + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), + GrafanaLokiLogs: &data, + } + } + if healthSourceType == "AzureLogs" { + data := nextgen.NextGenHealthSource{} + json.Unmarshal([]byte(healthSource), &data) + + return nextgen.HealthSource{ + Name: hs["name"].(string), + Identifier: hs["identifier"].(string), + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), + AzureLogs: &data, + } + } + if healthSourceType == "AzureMetrics" { + data := nextgen.NextGenHealthSource{} + json.Unmarshal([]byte(healthSource), &data) + + return nextgen.HealthSource{ + Name: hs["name"].(string), + Identifier: hs["identifier"].(string), + Version: hs["version"].(string), + Type_: nextgen.HealthSourceType(healthSourceType), + AzureMetrics: &data, + } + } panic(fmt.Sprintf("Invalid health source type for monitored service")) } @@ -188,12 +286,12 @@ func getChangeSourceByType(cs map[string]interface{}) nextgen.ChangeSourceDto { json.Unmarshal([]byte(changeSourceSpec), &data) return nextgen.ChangeSourceDto{ - Name: cs["name"].(string), - Identifier: cs["identifier"].(string), - Type_: nextgen.ChangeSourceType(changeSourceType), + Name: cs["name"].(string), + Identifier: cs["identifier"].(string), + Type_: nextgen.ChangeSourceType(changeSourceType), HarnessCDNextGen: &data, - Enabled: cs["enabled"].(bool), - Category: cs["category"].(string), + Enabled: cs["enabled"].(bool), + Category: cs["category"].(string), } } if changeSourceType == "PagerDuty" { @@ -201,12 +299,12 @@ func getChangeSourceByType(cs map[string]interface{}) nextgen.ChangeSourceDto { json.Unmarshal([]byte(changeSourceSpec), &data) return nextgen.ChangeSourceDto{ - Name: cs["name"].(string), - Identifier: cs["identifier"].(string), - Type_: nextgen.ChangeSourceType(changeSourceType), - PagerDuty: &data, - Enabled: cs["enabled"].(bool), - Category: cs["category"].(string), + Name: cs["name"].(string), + Identifier: cs["identifier"].(string), + Type_: nextgen.ChangeSourceType(changeSourceType), + PagerDuty: &data, + Enabled: cs["enabled"].(bool), + Category: cs["category"].(string), } } if changeSourceType == "K8sCluster" { @@ -214,12 +312,12 @@ func getChangeSourceByType(cs map[string]interface{}) nextgen.ChangeSourceDto { json.Unmarshal([]byte(changeSourceSpec), &data) return nextgen.ChangeSourceDto{ - Name: cs["name"].(string), - Identifier: cs["identifier"].(string), - Type_: nextgen.ChangeSourceType(changeSourceType), + Name: cs["name"].(string), + Identifier: cs["identifier"].(string), + Type_: nextgen.ChangeSourceType(changeSourceType), K8sCluster: &data, - Enabled: cs["enabled"].(bool), - Category: cs["category"].(string), + Enabled: cs["enabled"].(bool), + Category: cs["category"].(string), } } if changeSourceType == "HarnessCD" { @@ -227,12 +325,12 @@ func getChangeSourceByType(cs map[string]interface{}) nextgen.ChangeSourceDto { json.Unmarshal([]byte(changeSourceSpec), &data) return nextgen.ChangeSourceDto{ - Name: cs["name"].(string), - Identifier: cs["identifier"].(string), - Type_: nextgen.ChangeSourceType(changeSourceType), - HarnessCD: &data, - Enabled: cs["enabled"].(bool), - Category: cs["category"].(string), + Name: cs["name"].(string), + Identifier: cs["identifier"].(string), + Type_: nextgen.ChangeSourceType(changeSourceType), + HarnessCD: &data, + Enabled: cs["enabled"].(bool), + Category: cs["category"].(string), } } From 25c0371c2ca91b79323bf22b82ca4abb7bb371ed Mon Sep 17 00:00:00 2001 From: Aditya Kashyap <122971747+adiyaar24@users.noreply.github.com> Date: Tue, 29 Aug 2023 16:10:31 +0530 Subject: [PATCH 5/8] Updated the User to have 1 max parallel calls (#668) --- .changelog/668.txt | 3 +++ internal/service/platform/user/resource_user.go | 6 ++++++ 2 files changed, 9 insertions(+) create mode 100644 .changelog/668.txt diff --git a/.changelog/668.txt b/.changelog/668.txt new file mode 100644 index 000000000..c77d2475d --- /dev/null +++ b/.changelog/668.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/harness_plaform_user: Limit the user creation call to 1 at a time. +``` diff --git a/internal/service/platform/user/resource_user.go b/internal/service/platform/user/resource_user.go index a0e433495..106e602e8 100644 --- a/internal/service/platform/user/resource_user.go +++ b/internal/service/platform/user/resource_user.go @@ -141,7 +141,11 @@ func resourceUserRead(ctx context.Context, d *schema.ResourceData, meta interfac return nil } +var creationSemaphore = make(chan struct{}, 1) + func resourceUserCreateOrUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + creationSemaphore <- struct{}{} + defer func() { <-creationSemaphore }() c, ctx := meta.(*internal.Session).GetPlatformClientWithContext(ctx) id := d.Id() @@ -184,6 +188,8 @@ func resourceUserCreateOrUpdate(ctx context.Context, d *schema.ResourceData, met } func resourceUserDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + creationSemaphore <- struct{}{} + defer func() { <-creationSemaphore }() c, ctx := meta.(*internal.Session).GetPlatformClientWithContext(ctx) uuid := d.Get("identifier").(string) From 7e33f764ea9f26b919a222b4bfd8ba2334156f79 Mon Sep 17 00:00:00 2001 From: Harness CI Date: Tue, 29 Aug 2023 10:57:14 +0000 Subject: [PATCH 6/8] Update Changelog --- CHANGELOG.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bdfffe04..fc3ba7242 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +# 0.24.4 (August 29,2023) + +ENHANCEMENTS: + +* data_source_monitored_service_test.go Added tests for multiple healthsources such as Prometheus, Datadog etc. +resource_monitored_service.go Added version field and renamed MonitoredServiceSpec to MonitoredService +resource_monitored_service_test.go renamed MonitoredServiceSpec to MonitoredService +utils.go Deserializer updated with new health sources such as azure, signalFx, loki and sumologic +platform_monitored_service.md Added docs for health sources such as azure, signalFx, loki and sumologic +resource.tf Added examples for all newly added health sources, datadog and prometheus ([#669](https://github.com/harness/terraform-provider-harness/issues/669)) +* harness_platform_pipeline - Added support to import pipeline entity from git. ([#643](https://github.com/harness/terraform-provider-harness/issues/643)) +* resource/harness_plaform_user: Limit the user creation call to 1 at a time. ([#668](https://github.com/harness/terraform-provider-harness/issues/668)) + +BUG FIXES: + +* Fixed harness_platform_file_store_folder create resource plugin crash, when service account token was used to create ([#665](https://github.com/harness/terraform-provider-harness/issues/665)) + # 0.24.3 (August 22,2023) BUG FIXES: From 8da1f59a5b14d15bca03642c946b3b1522577064 Mon Sep 17 00:00:00 2001 From: Rohit Karelia Date: Tue, 29 Aug 2023 13:43:47 -0700 Subject: [PATCH 7/8] fix: [CDS-76702]: Update go-sdk for policy-mgmt enable/disable fix (#670) * fix: [CDS-76702]: Update go-sdk for policy-mgmt enable/disable fix * fix: [CDS-76702]: Update changelog --- .changelog/670.txt | 3 +++ go.mod | 17 +------------- go.sum | 57 ++-------------------------------------------- 3 files changed, 6 insertions(+), 71 deletions(-) create mode 100644 .changelog/670.txt diff --git a/.changelog/670.txt b/.changelog/670.txt new file mode 100644 index 000000000..fd1d6aa0a --- /dev/null +++ b/.changelog/670.txt @@ -0,0 +1,3 @@ +```release-note:bug +Fixed policy-set api to correctly enable/disable policy-sets +``` \ No newline at end of file diff --git a/go.mod b/go.mod index e16e4ae9b..7a46117c8 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/antihax/optional v1.0.0 github.com/docker/docker v24.0.5+incompatible - github.com/harness/harness-go-sdk v0.3.46 + github.com/harness/harness-go-sdk v0.3.47 github.com/harness/harness-openapi-go-client v0.0.18 github.com/hashicorp/go-cleanhttp v0.5.2 github.com/hashicorp/go-retryablehttp v0.7.4 @@ -17,15 +17,10 @@ require ( require ( github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect - github.com/Masterminds/goutils v1.1.1 // indirect - github.com/Masterminds/semver/v3 v3.1.1 // indirect - github.com/Masterminds/sprig/v3 v3.2.2 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect github.com/agext/levenshtein v1.2.3 // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect - github.com/armon/go-radix v1.0.0 // indirect - github.com/bgentry/speakeasy v0.1.0 // indirect github.com/cloudflare/circl v1.3.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect @@ -35,7 +30,6 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-cmp v0.5.9 // indirect - github.com/google/uuid v1.3.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect @@ -49,20 +43,16 @@ require ( github.com/hashicorp/logutils v1.0.0 // indirect github.com/hashicorp/terraform-exec v0.18.1 // indirect github.com/hashicorp/terraform-json v0.17.1 // indirect - github.com/hashicorp/terraform-plugin-docs v0.16.0 // indirect github.com/hashicorp/terraform-plugin-go v0.18.0 // indirect github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect github.com/hashicorp/terraform-registry-address v0.2.2 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect github.com/hashicorp/yamux v0.1.1 // indirect - github.com/huandu/xstrings v1.3.2 // indirect - github.com/imdario/mergo v0.3.13 // indirect github.com/jhump/protoreflect v1.6.1 // indirect github.com/jinzhu/copier v0.4.0 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect - github.com/mitchellh/cli v1.1.5 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect @@ -72,17 +62,12 @@ require ( github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc4 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/posener/complete v1.2.3 // indirect - github.com/russross/blackfriday v1.6.0 // indirect - github.com/shopspring/decimal v1.3.1 // indirect - github.com/spf13/cast v1.5.0 // indirect github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816 // indirect github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/zclconf/go-cty v1.13.2 // indirect golang.org/x/crypto v0.12.0 // indirect - golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect golang.org/x/mod v0.12.0 // indirect golang.org/x/net v0.14.0 // indirect golang.org/x/oauth2 v0.11.0 // indirect diff --git a/go.sum b/go.sum index da69fd500..878ac7796 100644 --- a/go.sum +++ b/go.sum @@ -1,12 +1,5 @@ github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= -github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= -github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= -github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= -github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/Masterminds/sprig/v3 v3.2.1/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= -github.com/Masterminds/sprig/v3 v3.2.2 h1:17jRggJu518dr3QaafizSXOjKYp94wKfABxUmyxvxX8= -github.com/Masterminds/sprig/v3 v3.2.2/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 h1:KLq8BE0KwCL+mmXnjLWEAOYO+2l2AE4YMmqG1ZpZHBs= @@ -19,11 +12,6 @@ github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kd github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= -github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= @@ -40,7 +28,6 @@ github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5Xh github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= @@ -59,14 +46,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/harness/harness-go-sdk v0.3.44 h1:DMcLBqtRiuQGeBT/cqx6jax4oe0NrDJ9Fbjspz7NNdM= -github.com/harness/harness-go-sdk v0.3.44/go.mod h1:CPXydorp4zd5Dz2u2FXiHyWL4yd5PQafOMN69cgPSvk= -github.com/harness/harness-go-sdk v0.3.46 h1:zLtYMU3rkiANMbPblGM7tMFCrMriZPnVw3UNeod6GUk= -github.com/harness/harness-go-sdk v0.3.46/go.mod h1:CPXydorp4zd5Dz2u2FXiHyWL4yd5PQafOMN69cgPSvk= +github.com/harness/harness-go-sdk v0.3.47 h1:2XwMDY33ygt1Zxyloyy6/s/ARk0o4J54lD9dRv2h534= +github.com/harness/harness-go-sdk v0.3.47/go.mod h1:CPXydorp4zd5Dz2u2FXiHyWL4yd5PQafOMN69cgPSvk= github.com/harness/harness-openapi-go-client v0.0.18 h1:gPhLOSOwjmZJ3aLjJiBbWPOMSBm8h72wbVSfx19eWZM= github.com/harness/harness-openapi-go-client v0.0.18/go.mod h1:u0vqYb994BJGotmEwJevF4L3BNAdU9i8ui2d22gmLPA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -82,7 +63,6 @@ github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBM github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-plugin v1.4.10 h1:xUbmA4jC6Dq163/fWcp8P3JuHilrHHMLNRxzGQJ9hNk= @@ -104,8 +84,6 @@ github.com/hashicorp/terraform-exec v0.18.1 h1:LAbfDvNQU1l0NOQlTuudjczVhHj061fNX github.com/hashicorp/terraform-exec v0.18.1/go.mod h1:58wg4IeuAJ6LVsLUeD2DWZZoc/bYi6dzhLHzxM41980= github.com/hashicorp/terraform-json v0.17.1 h1:eMfvh/uWggKmY7Pmb3T85u86E2EQg6EQHgyRwf3RkyA= github.com/hashicorp/terraform-json v0.17.1/go.mod h1:Huy6zt6euxaY9knPAFKjUITn8QxUFIe9VuSzb4zn/0o= -github.com/hashicorp/terraform-plugin-docs v0.16.0 h1:UmxFr3AScl6Wged84jndJIfFccGyBZn52KtMNsS12dI= -github.com/hashicorp/terraform-plugin-docs v0.16.0/go.mod h1:M3ZrlKBJAbPMtNOPwHicGi1c+hZUh7/g0ifT/z7TVfA= github.com/hashicorp/terraform-plugin-go v0.18.0 h1:IwTkOS9cOW1ehLd/rG0y+u/TGLK9y6fGoBjXVUquzpE= github.com/hashicorp/terraform-plugin-go v0.18.0/go.mod h1:l7VK+2u5Kf2y+A+742GX0ouLut3gttudmvMgN0PA74Y= github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= @@ -118,12 +96,7 @@ github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= -github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= -github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= -github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= -github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= -github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jhump/protoreflect v1.6.1 h1:4/2yi5LyDPP7nN+Hiird1SAJ6YoxUm13/oxHGRnbPd8= github.com/jhump/protoreflect v1.6.1/go.mod h1:RZQ/lnuN+zqeRVpQigTwO6o0AJUkxbnSnpuG7toUTG4= @@ -141,20 +114,15 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mitchellh/cli v1.1.5 h1:OxRIeJXpAMztws/XHlN2vu6imG5Dpq+j61AzAX5fLng= -github.com/mitchellh/cli v1.1.5/go.mod h1:v8+iFts2sPIKUV1ltktPXMCC8fumSKFItNcD2cLtRR4= -github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= @@ -163,7 +131,6 @@ github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQ github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA= @@ -181,32 +148,19 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= -github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= -github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= -github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= -github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/skeema/knownhosts v1.1.0 h1:Wvr9V0MxhjRbl3f9nMnKnFfiWTJmtECJ9Njkea3ysW0= -github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= -github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -231,16 +185,12 @@ github.com/zclconf/go-cty v1.13.2 h1:4GvrUxe/QUDYuJKAav4EYqdM47/kZa672LwmXFmEKT0 github.com/zclconf/go-cty v1.13.2/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME= -golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -337,10 +287,7 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.3.0 h1:MfDY1b1/0xN1CyMlQDac0ziEy9zJQd9CXBRRDHw2jJo= From 57e42e10bd92e6228d0b3a74f10dfa4f8a5ba839 Mon Sep 17 00:00:00 2001 From: Harness CI Date: Tue, 29 Aug 2023 20:49:39 +0000 Subject: [PATCH 8/8] Update Changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc3ba7242..fde8e0679 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 0.24.5 (August 29,2023) + +BUG FIXES: + +* Fixed policy-set api to correctly enable/disable policy-sets ([#670](https://github.com/harness/terraform-provider-harness/issues/670)) + # 0.24.4 (August 29,2023) ENHANCEMENTS: