Skip to content

Commit 06fd9f8

Browse files
Merge pull request #36 from cortexapps/CET-12955-deprecate-domain-parents
Deprecate x-cortex-domain-parents and use x-cortex-parents
2 parents b39d751 + 5703173 commit 06fd9f8

13 files changed

+103
-97
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ website/node_modules
2323
.idea
2424
*.iml
2525
*.test
26+
*.env
2627

2728
website/vendor
2829
vendor/

.golangci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ linters:
99
enable:
1010
- durationcheck
1111
- errcheck
12-
- exportloopref
12+
- copyloopvar
1313
- godot
1414
- gofmt
1515
- gosimple
@@ -23,4 +23,4 @@ linters:
2323
- unconvert
2424
- unparam
2525
- unused
26-
- vet
26+
- govet

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ Changelog for the Cortex terraform provider.
22

33
## Unreleased
44

5+
## 0.4.0
6+
* Deprecate `x-cortex-parents` and use `x-cortex-parents` instead
7+
- Bump Go version 1.20 -> 1.22
8+
59
## 0.3.1
610
* Fix serialization for `git` / `sonarqube` / `codecov`
711
* Make owner type case insensitive

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ HOSTNAME=github.com
22
NAMESPACE=cortexapps
33
NAME=cortex
44
BINARY=terraform-provider-${NAME}
5-
VERSION=0.3.2-dev
5+
VERSION=0.4.1-dev
66

77
GOOS?=$(shell go env | grep GOOS | cut -d '=' -f2 | tr -d "'")
88
GOARCH?=$(shell go env | grep GOARCH | cut -d '=' -f2 | tr -d "'")
@@ -35,6 +35,9 @@ lint:
3535
docs:
3636
go generate ./...
3737

38+
format:
39+
go fmt ./...
40+
3841
# unit tests
3942
test:
4043
go clean -testcache

docs/resources/catalog_entity.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ Catalog Entity
3333
- `definition` (String) Set when the entity is a Resource. These are the properties defined by the Resource Definition, in JSON format in a string (use the `jsonencode` function to convert a JSON object to a string).
3434
- `dependencies` (Attributes List) List of dependencies for the entity. (see [below for nested schema](#nestedatt--dependencies))
3535
- `description` (String) Description of the entity visible in the Service or Resource Catalog. Markdown is supported.
36-
- `domain_parents` (Attributes List) List of parent domains for the entity. The list of parents can only be entities of type `DOMAIN`. (see [below for nested schema](#nestedatt--domain_parents))
3736
- `firehydrant` (Attributes) FireHydrant configuration for the entity. (see [below for nested schema](#nestedatt--firehydrant))
3837
- `git` (Attributes) Git configuration for the entity. (see [below for nested schema](#nestedatt--git))
3938
- `groups` (List of String) List of groups related to the entity.
@@ -46,6 +45,7 @@ Catalog Entity
4645
- `microsoft_teams` (Attributes List) List of Microsoft Teams channels for the entity. (see [below for nested schema](#nestedatt--microsoft_teams))
4746
- `on_call` (Attributes) On-call configuration for the entity. (see [below for nested schema](#nestedatt--on_call))
4847
- `owners` (Attributes List) List of owners for the entity. Owners can be users, groups, or Slack channels. (see [below for nested schema](#nestedatt--owners))
48+
- `parents` (Attributes List) List of parents for the entity. The list of parents can only be entities of type `DOMAIN`. (see [below for nested schema](#nestedatt--parents))
4949
- `rollbar` (Attributes) Rollbar configuration for the entity. (see [below for nested schema](#nestedatt--rollbar))
5050
- `sentry` (Attributes) Sentry configuration for the entity. (see [below for nested schema](#nestedatt--sentry))
5151
- `service_now` (Attributes) ServiceNow configuration for the entity. (see [below for nested schema](#nestedatt--service_now))
@@ -228,14 +228,6 @@ Optional:
228228
- `path` (String) The actual endpoint this dependency refers to.
229229

230230

231-
<a id="nestedatt--domain_parents"></a>
232-
### Nested Schema for `domain_parents`
233-
234-
Required:
235-
236-
- `tag` (String) Tag of the parent domain.
237-
238-
239231
<a id="nestedatt--firehydrant"></a>
240232
### Nested Schema for `firehydrant`
241233

@@ -504,6 +496,14 @@ Optional:
504496
- `provider` (String) Provider of the owner. Only allowed if `type` is `group`.
505497

506498

499+
<a id="nestedatt--parents"></a>
500+
### Nested Schema for `parents`
501+
502+
Required:
503+
504+
- `tag` (String) Tag of the parent domain.
505+
506+
507507
<a id="nestedatt--rollbar"></a>
508508
### Nested Schema for `rollbar`
509509

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/cortexapps/terraform-provider-cortex
22

3-
go 1.20
3+
go 1.22
44

55
require (
66
github.com/dghubble/sling v1.4.1

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,6 @@ github.com/hashicorp/terraform-json v0.17.1 h1:eMfvh/uWggKmY7Pmb3T85u86E2EQg6EQH
185185
github.com/hashicorp/terraform-json v0.17.1/go.mod h1:Huy6zt6euxaY9knPAFKjUITn8QxUFIe9VuSzb4zn/0o=
186186
github.com/hashicorp/terraform-plugin-docs v0.16.0 h1:UmxFr3AScl6Wged84jndJIfFccGyBZn52KtMNsS12dI=
187187
github.com/hashicorp/terraform-plugin-docs v0.16.0/go.mod h1:M3ZrlKBJAbPMtNOPwHicGi1c+hZUh7/g0ifT/z7TVfA=
188-
github.com/hashicorp/terraform-plugin-framework v1.4.0 h1:WKbtCRtNrjsh10eA7NZvC/Qyr7zp77j+D21aDO5th9c=
189-
github.com/hashicorp/terraform-plugin-framework v1.4.0/go.mod h1:XC0hPcQbBvlbxwmjxuV/8sn8SbZRg4XwGMs22f+kqV0=
190188
github.com/hashicorp/terraform-plugin-framework v1.4.1 h1:ZC29MoB3Nbov6axHdgPbMz7799pT5H8kIrM8YAsaVrs=
191189
github.com/hashicorp/terraform-plugin-framework v1.4.1/go.mod h1:XC0hPcQbBvlbxwmjxuV/8sn8SbZRg4XwGMs22f+kqV0=
192190
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 h1:HOjBuMbOEzl7snOdOoUfE2Jgeto6JOjLVQ39Ls2nksc=

internal/cortex/catalog_entity_parser.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ func (c *CatalogEntityParser) YamlToEntity(yamlEntity map[string]interface{}) (C
4444
c.interpolateChildren(&entity, info["x-cortex-children"].([]interface{}))
4545
}
4646

47-
entity.DomainParents = []CatalogEntityDomainParent{}
48-
if info["x-cortex-domain-parents"] != nil {
49-
c.interpolateDomainParents(&entity, info["x-cortex-domain-parents"].([]interface{}))
47+
entity.Parents = []CatalogEntityParent{}
48+
if info["x-cortex-parents"] != nil {
49+
c.interpolateParents(&entity, info["x-cortex-parents"].([]interface{}))
5050
}
5151

5252
entity.Metadata = map[string]interface{}{}
@@ -196,10 +196,10 @@ func (c *CatalogEntityParser) interpolateChildren(entity *CatalogEntityData, chi
196196
}
197197
}
198198

199-
func (c *CatalogEntityParser) interpolateDomainParents(entity *CatalogEntityData, parents []interface{}) {
199+
func (c *CatalogEntityParser) interpolateParents(entity *CatalogEntityData, parents []interface{}) {
200200
for _, parent := range parents {
201201
parentMap := parent.(map[string]interface{})
202-
entity.DomainParents = append(entity.DomainParents, CatalogEntityDomainParent{
202+
entity.Parents = append(entity.Parents, CatalogEntityParent{
203203
Tag: MapFetchToString(parentMap, "tag"),
204204
})
205205
}

internal/cortex/integrations.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ package cortex
88
// match the structure of the CatalogEntity struct in other responses.
99
// See: https://github.com/cortexapps/solutions/blob/master/examples/yaml/catalog/resource.yaml
1010
type CatalogEntityData struct {
11-
Title string `json:"title" yaml:"title"`
12-
Description string `json:"description,omitempty" yaml:"description,omitempty"`
13-
Tag string `json:"x-cortex-tag" yaml:"x-cortex-tag"`
14-
Type string `json:"x-cortex-type,omitempty" yaml:"x-cortex-type,omitempty"`
15-
Definition map[string]interface{} `json:"x-cortex-definition,omitempty" yaml:"x-cortex-definition,omitempty"`
16-
Owners []CatalogEntityOwner `json:"x-cortex-owners,omitempty" yaml:"x-cortex-owners,omitempty"`
17-
Children []CatalogEntityChild `json:"x-cortex-children,omitempty" yaml:"x-cortex-children,omitempty"`
18-
DomainParents []CatalogEntityDomainParent `json:"x-cortex-domain-parents,omitempty" yaml:"x-cortex-domain-parents,omitempty"`
19-
Groups []string `json:"x-cortex-groups,omitempty" yaml:"x-cortex-groups,omitempty"` // TODO: is this -groups or -service-groups? docs unclear
20-
Links []CatalogEntityLink `json:"x-cortex-link,omitempty" yaml:"x-cortex-link,omitempty"`
21-
IgnoreMetadata bool `json:"-" yaml:"-"`
22-
Metadata map[string]interface{} `json:"x-cortex-custom-metadata,omitempty" yaml:"x-cortex-custom-metadata,omitempty"`
23-
Dependencies []CatalogEntityDependency `json:"x-cortex-dependency,omitempty" yaml:"x-cortex-dependency,omitempty"`
11+
Title string `json:"title" yaml:"title"`
12+
Description string `json:"description,omitempty" yaml:"description,omitempty"`
13+
Tag string `json:"x-cortex-tag" yaml:"x-cortex-tag"`
14+
Type string `json:"x-cortex-type,omitempty" yaml:"x-cortex-type,omitempty"`
15+
Definition map[string]interface{} `json:"x-cortex-definition,omitempty" yaml:"x-cortex-definition,omitempty"`
16+
Owners []CatalogEntityOwner `json:"x-cortex-owners,omitempty" yaml:"x-cortex-owners,omitempty"`
17+
Children []CatalogEntityChild `json:"x-cortex-children,omitempty" yaml:"x-cortex-children,omitempty"`
18+
Parents []CatalogEntityParent `json:"x-cortex-parents,omitempty" yaml:"x-cortex-parents,omitempty"`
19+
Groups []string `json:"x-cortex-groups,omitempty" yaml:"x-cortex-groups,omitempty"` // TODO: is this -groups or -service-groups? docs unclear
20+
Links []CatalogEntityLink `json:"x-cortex-link,omitempty" yaml:"x-cortex-link,omitempty"`
21+
IgnoreMetadata bool `json:"-" yaml:"-"`
22+
Metadata map[string]interface{} `json:"x-cortex-custom-metadata,omitempty" yaml:"x-cortex-custom-metadata,omitempty"`
23+
Dependencies []CatalogEntityDependency `json:"x-cortex-dependency,omitempty" yaml:"x-cortex-dependency,omitempty"`
2424

2525
// Various generic integration attributes
2626
Alerts []CatalogEntityAlert `json:"x-cortex-alerts,omitempty" yaml:"x-cortex-alerts,omitempty"`
@@ -184,7 +184,7 @@ type CatalogEntityChild struct {
184184
Tag string `json:"tag" yaml:"tag"`
185185
}
186186

187-
type CatalogEntityDomainParent struct {
187+
type CatalogEntityParent struct {
188188
Tag string `json:"tag" yaml:"tag"`
189189
}
190190

internal/provider/catalog_entity_resource.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ func (r *CatalogEntityResource) Schema(ctx context.Context, req resource.SchemaR
135135
},
136136
},
137137
},
138-
"domain_parents": schema.ListNestedAttribute{
139-
MarkdownDescription: "List of parent domains for the entity. The list of parents can only be entities of type `DOMAIN`.",
138+
"parents": schema.ListNestedAttribute{
139+
MarkdownDescription: "List of parents for the entity. The list of parents can only be entities of type `DOMAIN`.",
140140
Optional: true,
141141
NestedObject: schema.NestedAttributeObject{
142142
Attributes: map[string]schema.Attribute{

0 commit comments

Comments
 (0)