Skip to content

Commit e2e46de

Browse files
Munklinde96Harness
authored andcommitted
feat: [IDP-7872]: Add GitX to idp catalog entities (#1336)
* e47443 Add Git Experience to IDP catalog entities
1 parent 48dc3e1 commit e2e46de

File tree

9 files changed

+634
-116
lines changed

9 files changed

+634
-116
lines changed

.changelog/1336.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
```release-note:fix
2+
resource: platform_idp_catalog_entity: Add support for Git Experience to catalog entities.
3+
Added git_details and import_from_git fields.
4+
data-source: platform_idp_catalog_entity: Added corresponding git fields.
5+
```

docs/data-sources/platform_idp_catalog_entity.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,22 @@ Data source for retrieving Harness catalog entities.
2727

2828
### Read-Only
2929

30+
- `git_details` (List of Object) Contains Git Information for importing entities from Git (see [below for nested schema](#nestedatt--git_details))
3031
- `id` (String) The ID of this resource.
3132
- `yaml` (String) YAML definition of the catalog entity
33+
34+
<a id="nestedatt--git_details"></a>
35+
### Nested Schema for `git_details`
36+
37+
Read-Only:
38+
39+
- `base_branch` (String)
40+
- `branch_name` (String)
41+
- `commit_message` (String)
42+
- `connector_ref` (String)
43+
- `file_path` (String)
44+
- `is_harness_code_repo` (Boolean)
45+
- `last_commit_id` (String)
46+
- `last_object_id` (String)
47+
- `repo_name` (String)
48+
- `store_type` (String)

docs/resources/platform_idp_catalog_entity.md

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,49 @@ resource "harness_platform_idp_catalog_entity" "test" {
7575
- test
7676
EOT
7777
}
78+
79+
# Project level catalog entity with git experience
80+
resource "harness_platform_idp_catalog_entity" "test_with_git_experience" {
81+
identifier = "identifier"
82+
kind = "component"
83+
org_id = "org_id"
84+
project_id = "project_id"
85+
git_details {
86+
branch_name = "main"
87+
file_path = "path/to/file.yaml"
88+
repo_name = "repo_name"
89+
store_type = "REMOTE"
90+
}
91+
yaml = <<-EOT
92+
apiVersion: harness.io/v1
93+
kind: Component
94+
name: Example Catalog
95+
identifier: "identifier"
96+
orgIdentifier: org_id
97+
projectIdentifier: project_id
98+
type: service
99+
owner: user:account/admin@harness.io
100+
spec:
101+
lifecycle: prod
102+
metadata:
103+
tags:
104+
- test
105+
EOT
106+
}
107+
108+
# Project level catalog entity with git experience - With import
109+
resource "harness_platform_idp_catalog_entity" "test_with_git_import" {
110+
identifier = "identifier"
111+
org_id = "org_id"
112+
project_id = "project_id"
113+
import_from_git = true
114+
git_details {
115+
branch_name = "main"
116+
file_path = "path/to/file.yaml"
117+
repo_name = "repo_name"
118+
store_type = "REMOTE"
119+
}
120+
}
78121
```
79122

80123
<!-- schema generated by tfplugindocs -->
@@ -83,18 +126,36 @@ resource "harness_platform_idp_catalog_entity" "test" {
83126
### Required
84127

85128
- `identifier` (String) Unique identifier of the resource.
86-
- `kind` (String) Kind of the catalog entity
87-
- `yaml` (String) YAML definition of the catalog entity
88129

89130
### Optional
90131

132+
- `git_details` (Block List, Max: 1) Contains Git Information for importing entities from Git (see [below for nested schema](#nestedblock--git_details))
133+
- `import_from_git` (Boolean) Flag to set if importing from Git
134+
- `kind` (String) Kind of the catalog entity
91135
- `org_id` (String) Unique identifier of the organization.
92136
- `project_id` (String) Unique identifier of the project.
137+
- `yaml` (String) YAML definition of the catalog entity
93138

94139
### Read-Only
95140

96141
- `id` (String) The ID of this resource.
97142

143+
<a id="nestedblock--git_details"></a>
144+
### Nested Schema for `git_details`
145+
146+
Optional:
147+
148+
- `base_branch` (String) Name of the default branch (this checks out a new branch titled by branch_name).
149+
- `branch_name` (String) Name of the branch.
150+
- `commit_message` (String) Commit message used for the merge commit.
151+
- `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}.
152+
- `file_path` (String) File path of the Entity in the repository.
153+
- `is_harness_code_repo` (Boolean) If the repo is a Harness Code repo
154+
- `last_commit_id` (String) Last commit identifier (for Git Repositories other than Github). To be provided only when updating Pipeline.
155+
- `last_object_id` (String) Last object identifier (for Github). To be provided only when updating Pipeline.
156+
- `repo_name` (String) Name of the repository.
157+
- `store_type` (String) Specifies whether the Entity is to be stored in Git or not. Possible values: INLINE, REMOTE.
158+
98159
## Import
99160

100161
Import is supported using the following syntax:

examples/resources/harness_platform_idp_catalog_entity/resource.tf

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,46 @@ resource "harness_platform_idp_catalog_entity" "test" {
6060
- test
6161
EOT
6262
}
63+
64+
# Project level catalog entity with git experience
65+
resource "harness_platform_idp_catalog_entity" "test_with_git_experience" {
66+
identifier = "identifier"
67+
kind = "component"
68+
org_id = "org_id"
69+
project_id = "project_id"
70+
git_details {
71+
branch_name = "main"
72+
file_path = "path/to/file.yaml"
73+
repo_name = "repo_name"
74+
store_type = "REMOTE"
75+
}
76+
yaml = <<-EOT
77+
apiVersion: harness.io/v1
78+
kind: Component
79+
name: Example Catalog
80+
identifier: "identifier"
81+
orgIdentifier: org_id
82+
projectIdentifier: project_id
83+
type: service
84+
owner: user:account/admin@harness.io
85+
spec:
86+
lifecycle: prod
87+
metadata:
88+
tags:
89+
- test
90+
EOT
91+
}
92+
93+
# Project level catalog entity with git experience - With import
94+
resource "harness_platform_idp_catalog_entity" "test_with_git_import" {
95+
identifier = "identifier"
96+
org_id = "org_id"
97+
project_id = "project_id"
98+
import_from_git = true
99+
git_details {
100+
branch_name = "main"
101+
file_path = "path/to/file.yaml"
102+
repo_name = "repo_name"
103+
store_type = "REMOTE"
104+
}
105+
}

go.mod

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/aws/aws-sdk-go v1.55.8
1010
github.com/docker/docker v28.5.2+incompatible
1111
github.com/google/uuid v1.6.0
12-
github.com/harness/harness-go-sdk v0.7.1
12+
github.com/harness/harness-go-sdk v0.7.2
1313
github.com/harness/harness-openapi-go-client v0.0.25
1414
github.com/hashicorp/go-cleanhttp v0.5.2
1515
github.com/hashicorp/go-cty v1.5.0
@@ -29,11 +29,11 @@ require (
2929
github.com/ProtonMail/go-crypto v1.1.6 // indirect
3030
github.com/agext/levenshtein v1.2.3 // indirect
3131
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
32+
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
3233
github.com/cespare/xxhash/v2 v2.3.0 // indirect
3334
github.com/cloudflare/circl v1.6.1 // indirect
3435
github.com/containerd/errdefs v1.0.0 // indirect
3536
github.com/containerd/errdefs/pkg v0.3.0 // indirect
36-
github.com/containerd/log v0.1.0 // indirect
3737
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
3838
github.com/distribution/reference v0.6.0 // indirect
3939
github.com/docker/go-connections v0.6.0 // indirect
@@ -42,9 +42,9 @@ require (
4242
github.com/felixge/httpsnoop v1.0.4 // indirect
4343
github.com/go-logr/logr v1.4.3 // indirect
4444
github.com/go-logr/stdr v1.2.2 // indirect
45-
github.com/gogo/protobuf v1.3.2 // indirect
4645
github.com/golang/protobuf v1.5.4 // indirect
4746
github.com/google/go-cmp v0.7.0 // indirect
47+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 // indirect
4848
github.com/hashicorp/errwrap v1.1.0 // indirect
4949
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
5050
github.com/hashicorp/go-hclog v1.6.3 // indirect
@@ -70,7 +70,7 @@ require (
7070
github.com/mitchellh/mapstructure v1.5.0 // indirect
7171
github.com/mitchellh/reflectwalk v1.0.2 // indirect
7272
github.com/moby/docker-image-spec v1.3.1 // indirect
73-
github.com/moby/sys/atomicwriter v0.1.0 // indirect
73+
github.com/moby/sys/sequential v0.6.0 // indirect
7474
github.com/oklog/run v1.1.0 // indirect
7575
github.com/opencontainers/go-digest v1.0.0 // indirect
7676
github.com/opencontainers/image-spec v1.1.1 // indirect
@@ -83,22 +83,25 @@ require (
8383
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
8484
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.64.0 // indirect
8585
go.opentelemetry.io/otel v1.39.0 // indirect
86-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.39.0 // indirect
86+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.39.0 // indirect
8787
go.opentelemetry.io/otel/metric v1.39.0 // indirect
8888
go.opentelemetry.io/otel/trace v1.39.0 // indirect
89+
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
8990
golang.org/x/crypto v0.45.0 // indirect
9091
golang.org/x/mod v0.29.0 // indirect
9192
golang.org/x/net v0.47.0 // indirect
9293
golang.org/x/oauth2 v0.34.0 // indirect
9394
golang.org/x/sync v0.18.0 // indirect
94-
golang.org/x/sys v0.39.0 // indirect
95+
golang.org/x/sys v0.40.0 // indirect
9596
golang.org/x/text v0.31.0 // indirect
9697
golang.org/x/tools v0.38.0 // indirect
9798
google.golang.org/appengine v1.6.8 // indirect
99+
google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect
98100
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect
99101
google.golang.org/protobuf v1.36.10 // indirect
100102
gotest.tools/v3 v3.3.0 // indirect
101103
)
102104

103105
// replace github.com/harness/harness-go-sdk => ../harness-go-sdk
106+
104107
//replace github.com/harness/harness-openapi-go-client => ../harness-openapi-go-client

0 commit comments

Comments
 (0)