Skip to content

Commit

Permalink
Rename resource_tag_filter -> resource_discovery_tag_filter
Browse files Browse the repository at this point in the history
  • Loading branch information
andriikushch committed Dec 11, 2024
1 parent 094e584 commit 0dca871
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 43 deletions.
22 changes: 11 additions & 11 deletions docs/data-sources/cloud_provider_azure_credential.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ resource "grafana_cloud_provider_azure_credential" "test" {
client_secret = "my-client-secret"
tenant_id = "my-tenant-id"
resource_tag_filter {
resource_discovery_tag_filter {
key = "key-1"
value = "value-1"
}
resource_tag_filter {
resource_discovery_tag_filter {
key = "key-2"
value = "value-2"
}
Expand All @@ -39,14 +39,14 @@ data "grafana_cloud_provider_azure_credential" "test" {
tenant_id = grafana_cloud_provider_azure_credential.test.tenant_id
resource_id = grafana_cloud_provider_azure_credential.test.resource_id
resource_tag_filter {
key = grafana_cloud_provider_azure_credential.test.resource_tag_filter[0].key
value = grafana_cloud_provider_azure_credential.test.resource_tag_filter[0].value
resource_discovery_tag_filter {
key = grafana_cloud_provider_azure_credential.test.resource_discovery_tag_filter[0].key
value = grafana_cloud_provider_azure_credential.test.resource_discovery_tag_filter[0].value
}
resource_tag_filter {
key = grafana_cloud_provider_azure_credential.test.resource_tag_filter[1].key
value = grafana_cloud_provider_azure_credential.test.resource_tag_filter[1].value
resource_discovery_tag_filter {
key = grafana_cloud_provider_azure_credential.test.resource_discovery_tag_filter[1].key
value = grafana_cloud_provider_azure_credential.test.resource_discovery_tag_filter[1].value
}
}
```
Expand All @@ -65,14 +65,14 @@ data "grafana_cloud_provider_azure_credential" "test" {

### Optional

- `resource_tag_filter` (Block List) The list of tag filters to apply to resources. (see [below for nested schema](#nestedblock--resource_tag_filter))
- `resource_discovery_tag_filter` (Block List) The list of tag filters to apply to resources. (see [below for nested schema](#nestedblock--resource_discovery_tag_filter))

### Read-Only

- `id` (String) The Terraform Resource ID. This has the format "{{ stack_id }}:{{ resource_id }}".

<a id="nestedblock--resource_tag_filter"></a>
### Nested Schema for `resource_tag_filter`
<a id="nestedblock--resource_discovery_tag_filter"></a>
### Nested Schema for `resource_discovery_tag_filter`

Required:

Expand Down
10 changes: 5 additions & 5 deletions docs/resources/cloud_provider_azure_credential.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ resource "grafana_cloud_provider_azure_credential" "test" {
client_secret = "my-client-secret"
tenant_id = "my-tenant-id"
resource_tag_filter {
resource_discovery_tag_filter {
key = "key-1"
value = "value-1"
}
resource_tag_filter {
resource_discovery_tag_filter {
key = "key-2"
value = "value-2"
}
Expand All @@ -45,15 +45,15 @@ resource "grafana_cloud_provider_azure_credential" "test" {

### Optional

- `resource_tag_filter` (Block List) The list of tag filters to apply to resources. (see [below for nested schema](#nestedblock--resource_tag_filter))
- `resource_discovery_tag_filter` (Block List) The list of tag filters to apply to resources. (see [below for nested schema](#nestedblock--resource_discovery_tag_filter))

### Read-Only

- `id` (String) The Terraform Resource ID. This has the format "{{ stack_id }}:{{ resource_id }}".
- `resource_id` (String) The ID given by the Grafana Cloud Provider API to this AWS Account resource.

<a id="nestedblock--resource_tag_filter"></a>
### Nested Schema for `resource_tag_filter`
<a id="nestedblock--resource_discovery_tag_filter"></a>
### Nested Schema for `resource_discovery_tag_filter`

Required:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ resource "grafana_cloud_provider_azure_credential" "test" {
client_secret = "my-client-secret"
tenant_id = "my-tenant-id"

resource_tag_filter {
resource_discovery_tag_filter {
key = "key-1"
value = "value-1"
}
resource_tag_filter {
resource_discovery_tag_filter {
key = "key-2"
value = "value-2"
}
Expand All @@ -24,13 +24,13 @@ data "grafana_cloud_provider_azure_credential" "test" {
tenant_id = grafana_cloud_provider_azure_credential.test.tenant_id
resource_id = grafana_cloud_provider_azure_credential.test.resource_id

resource_tag_filter {
key = grafana_cloud_provider_azure_credential.test.resource_tag_filter[0].key
value = grafana_cloud_provider_azure_credential.test.resource_tag_filter[0].value
resource_discovery_tag_filter {
key = grafana_cloud_provider_azure_credential.test.resource_discovery_tag_filter[0].key
value = grafana_cloud_provider_azure_credential.test.resource_discovery_tag_filter[0].value
}

resource_tag_filter {
key = grafana_cloud_provider_azure_credential.test.resource_tag_filter[1].key
value = grafana_cloud_provider_azure_credential.test.resource_tag_filter[1].value
resource_discovery_tag_filter {
key = grafana_cloud_provider_azure_credential.test.resource_discovery_tag_filter[1].key
value = grafana_cloud_provider_azure_credential.test.resource_discovery_tag_filter[1].value
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ resource "grafana_cloud_provider_azure_credential" "test" {
client_secret = "my-client-secret"
tenant_id = "my-tenant-id"

resource_tag_filter {
resource_discovery_tag_filter {
key = "key-1"
value = "value-1"
}

resource_tag_filter {
resource_discovery_tag_filter {
key = "key-2"
value = "value-2"
}
Expand Down
2 changes: 1 addition & 1 deletion internal/common/cloudproviderapi/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ type AzureCredential struct {
StackID string `json:"stack_id"`

// ResourceTagFilters is the list of Azure resource tag filters.
ResourceTagFilters []TagFilter `json:"resource_tag_filters"`
ResourceTagFilters []TagFilter `json:"resource_discovery_tag_filters"`
}

type TagFilter struct {
Expand Down
22 changes: 11 additions & 11 deletions internal/resources/cloudprovider/azure_credential_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestAcc_AzureCredential(t *testing.T) {
"client_id": "my_client_id",
"client_secret": "",
"stack_id":"1",
"resource_tag_filters": [
"resource_discovery_tag_filters": [
{
"key": "key-1",
"value": "value-1"
Expand Down Expand Up @@ -56,7 +56,7 @@ func TestAcc_AzureCredential(t *testing.T) {
"client_id": "my-client-id",
"client_secret": "",
"stack_id":"1",
"resource_tag_filters": [
"resource_discovery_tag_filters": [
{
"key": "key-1",
"value": "value-1"
Expand All @@ -80,7 +80,7 @@ func TestAcc_AzureCredential(t *testing.T) {
"client_id": "my-client-id",
"client_secret": "",
"stack_id":"1",
"resource_tag_filters": [
"resource_discovery_tag_filters": [
{
"key": "key-1",
"value": "value-1"
Expand Down Expand Up @@ -122,10 +122,10 @@ func TestAcc_AzureCredential(t *testing.T) {
resource.TestCheckResourceAttr("grafana_cloud_provider_azure_credential.test", "tenant_id", "my-tenant-id"),
resource.TestCheckResourceAttr("grafana_cloud_provider_azure_credential.test", "client_id", "my-client-id"),
resource.TestCheckResourceAttr("grafana_cloud_provider_azure_credential.test", "client_secret", "my-client-secret"),
resource.TestCheckResourceAttr("grafana_cloud_provider_azure_credential.test", "resource_tag_filter.0.key", "key-1"),
resource.TestCheckResourceAttr("grafana_cloud_provider_azure_credential.test", "resource_tag_filter.1.key", "key-2"),
resource.TestCheckResourceAttr("grafana_cloud_provider_azure_credential.test", "resource_tag_filter.0.value", "value-1"),
resource.TestCheckResourceAttr("grafana_cloud_provider_azure_credential.test", "resource_tag_filter.1.value", "value-2"),
resource.TestCheckResourceAttr("grafana_cloud_provider_azure_credential.test", "resource_discovery_tag_filter.0.key", "key-1"),
resource.TestCheckResourceAttr("grafana_cloud_provider_azure_credential.test", "resource_discovery_tag_filter.1.key", "key-2"),
resource.TestCheckResourceAttr("grafana_cloud_provider_azure_credential.test", "resource_discovery_tag_filter.0.value", "value-1"),
resource.TestCheckResourceAttr("grafana_cloud_provider_azure_credential.test", "resource_discovery_tag_filter.1.value", "value-2"),
),
},
{
Expand All @@ -139,10 +139,10 @@ func TestAcc_AzureCredential(t *testing.T) {
resource.TestCheckResourceAttr("data.grafana_cloud_provider_azure_credential.test", "client_id", "my-client-id"),
resource.TestCheckResourceAttr("data.grafana_cloud_provider_azure_credential.test", "client_secret", ""),
resource.TestCheckResourceAttr("data.grafana_cloud_provider_azure_credential.test", "resource_id", resourceID),
resource.TestCheckResourceAttr("data.grafana_cloud_provider_azure_credential.test", "resource_tag_filter.0.key", "key-1"),
resource.TestCheckResourceAttr("data.grafana_cloud_provider_azure_credential.test", "resource_tag_filter.1.key", "key-2"),
resource.TestCheckResourceAttr("data.grafana_cloud_provider_azure_credential.test", "resource_tag_filter.0.value", "value-1"),
resource.TestCheckResourceAttr("data.grafana_cloud_provider_azure_credential.test", "resource_tag_filter.1.value", "value-2"),
resource.TestCheckResourceAttr("data.grafana_cloud_provider_azure_credential.test", "resource_discovery_tag_filter.0.key", "key-1"),
resource.TestCheckResourceAttr("data.grafana_cloud_provider_azure_credential.test", "resource_discovery_tag_filter.1.key", "key-2"),
resource.TestCheckResourceAttr("data.grafana_cloud_provider_azure_credential.test", "resource_discovery_tag_filter.0.value", "value-1"),
resource.TestCheckResourceAttr("data.grafana_cloud_provider_azure_credential.test", "resource_discovery_tag_filter.1.value", "value-2"),
),
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (r *datasourceAzureCredential) Schema(ctx context.Context, req datasource.S
},
},
Blocks: map[string]schema.Block{
"resource_tag_filter": schema.ListNestedBlock{
"resource_discovery_tag_filter": schema.ListNestedBlock{
Description: "The list of tag filters to apply to resources.",
NestedObject: schema.NestedBlockObject{
Attributes: map[string]schema.Attribute{
Expand Down
8 changes: 4 additions & 4 deletions internal/resources/cloudprovider/resource_azure_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type resourceAzureCredentialModel struct {
StackID types.String `tfsdk:"stack_id"`
ClientSecret types.String `tfsdk:"client_secret"`
ResourceID types.String `tfsdk:"resource_id"`
ResourceTagFilters []TagFilter `tfsdk:"resource_tag_filter"`
ResourceTagFilters []TagFilter `tfsdk:"resource_discovery_tag_filter"`
}

type resourceAzureCredential struct {
Expand Down Expand Up @@ -115,7 +115,7 @@ func (r *resourceAzureCredential) Schema(ctx context.Context, req resource.Schem
},
},
Blocks: map[string]schema.Block{
"resource_tag_filter": schema.ListNestedBlock{
"resource_discovery_tag_filter": schema.ListNestedBlock{
Description: "The list of tag filters to apply to resources.",
NestedObject: schema.NestedBlockObject{
Attributes: map[string]schema.Attribute{
Expand Down Expand Up @@ -258,7 +258,7 @@ func (r *resourceAzureCredential) Read(ctx context.Context, req resource.ReadReq
return
}

diags = resp.State.SetAttribute(ctx, path.Root("resource_tag_filter"), r.convertTagFilters(credential.ResourceTagFilters))
diags = resp.State.SetAttribute(ctx, path.Root("resource_discovery_tag_filter"), r.convertTagFilters(credential.ResourceTagFilters))
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
return
Expand Down Expand Up @@ -321,7 +321,7 @@ func (r *resourceAzureCredential) Update(ctx context.Context, req resource.Updat
return
}

diags = resp.State.SetAttribute(ctx, path.Root("resource_tag_filter"), r.convertTagFilters(credential.ResourceTagFilters))
diags = resp.State.SetAttribute(ctx, path.Root("resource_discovery_tag_filter"), r.convertTagFilters(credential.ResourceTagFilters))
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
return
Expand Down

0 comments on commit 0dca871

Please sign in to comment.