Skip to content

Commit

Permalink
[fix]: [CDS-72208]: Add more fields for overrides v2 data source (#636)
Browse files Browse the repository at this point in the history
* [fix]: [CDS-72208]: add more fields for overrides v2 data source

* [fix]: [CDS-72208]: add more fields for overrides v2 data source - 2
  • Loading branch information
lovish1999 committed Jul 27, 2023
1 parent b5a4c9f commit 6bd3b32
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/636.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
Add more fields for overrides v2 data source
```
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,44 @@ func DataSourceServiceOverrides() *schema.Resource {

ReadContext: dataSourceServiceOverridesRead,

Schema: map[string]*schema.Schema{},
Schema: map[string]*schema.Schema{
"service_id": {
Description: "The service ID to which the override entity is associated.",
Type: schema.TypeString,
Computed: true,
},
"env_id": {
Description: "The environment ID to which the override entity is associated.",
Type: schema.TypeString,
Computed: true,
},
"infra_id": {
Description: "The infrastructure ID to which the override entity is associated.",
Type: schema.TypeString,
Computed: true,
},
"cluster_id": {
Description: "The cluster ID to which the override entity is associated.",
Type: schema.TypeString,
Computed: true,
},
"type": {
Description: "The type of the override entity.",
Type: schema.TypeString,
Computed: true,
},
"yaml": {
Description: "The yaml of the override entity's spec property.",
Type: schema.TypeString,
Computed: true,
},
"identifier": {
Description: "The identifier of the override entity.",
Type: schema.TypeString,
ForceNew: true,
Required: true,
},
},
}

SetScopeDataResourceSchemaForServiceOverride(resource.Schema)
Expand Down Expand Up @@ -53,5 +90,4 @@ func dataSourceServiceOverridesRead(ctx context.Context, d *schema.ResourceData,
func SetScopeDataResourceSchemaForServiceOverride(s map[string]*schema.Schema) {
s["project_id"] = helpers.GetProjectIdSchema(helpers.SchemaFlagTypes.Optional)
s["org_id"] = helpers.GetOrgIdSchema(helpers.SchemaFlagTypes.Optional)
s["identifier"] = helpers.GetIdentifierSchema(helpers.SchemaFlagTypes.Required)
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,24 @@ func testAccDataSourceServiceOverrides(id string, name string) string {
org_id = harness_platform_service_overrides_v2.test.org_id
project_id = harness_platform_service_overrides_v2.test.project_id
}
resource "harness_platform_service_overrides_v2" "test2" {
org_id = data.harness_platform_service_overrides_v2.test.org_id
project_id = data.harness_platform_service_overrides_v2.test.project_id
env_id = data.harness_platform_service_overrides_v2.test.env_id
type = "ENV_GLOBAL_OVERRIDE"
yaml = <<-EOT
{
"variables": [
{
"name": "v2",
"type": "String",
"value": "val2"
}
]
}
EOT
}
`, id, name)

}

0 comments on commit 6bd3b32

Please sign in to comment.