Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/data-sources/cockpit_sources.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ data "scaleway_cockpit_sources" "my_sources" {
### Filter sources by origin

```hcl
data "scaleway_cockpit_sources" "external" {
data "scaleway_cockpit_sources" "custom" {
project_id = "11111111-1111-1111-1111-111111111111"
origin = "external"
origin = "custom"
}
```

Expand All @@ -61,7 +61,7 @@ The following arguments are supported:
- `region` - (Optional) The region in which the cockpit sources are located.
- `name` - (Optional) Filter sources by name.
- `type` - (Optional) Filter sources by type. Possible values are: `metrics`, `logs`, `traces`.
- `origin` - (Optional) Filter sources by origin. Possible values are: `scaleway`, `external`, `custom`.
- `origin` - (Optional) Filter sources by origin. Possible values are: `scaleway`, `custom`.

## Attributes Reference

Expand Down
2 changes: 1 addition & 1 deletion internal/services/cockpit/cockpit.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func ResourceCockpitRead(ctx context.Context, d *schema.ResourceData, m any) dia
dataSourcesRes, err := regionalAPI.ListDataSources(&cockpit.RegionalAPIListDataSourcesRequest{
Region: region,
ProjectID: projectID,
Origin: "external",
Origin: "custom",
}, scw.WithContext(ctx), scw.WithAllPages())
if err != nil {
return diag.FromErr(err)
Expand Down
16 changes: 0 additions & 16 deletions internal/services/cockpit/cockpit_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cockpit_test

import (
"fmt"
"testing"

"github.com/hashicorp/terraform-plugin-testing/helper/resource"
Expand Down Expand Up @@ -56,7 +55,6 @@ func TestAccCockpit_Basic(t *testing.T) {
resource.TestCheckResourceAttrSet("scaleway_cockpit.main", "plan"),
resource.TestCheckResourceAttr("scaleway_cockpit.main", "plan", "free"),
resource.TestCheckResourceAttrSet("scaleway_cockpit.main", "endpoints.0.grafana_url"),
checkGrafanaURL("scaleway_cockpit.main", "scaleway_account_project.project"),
),
},
},
Expand Down Expand Up @@ -128,20 +126,6 @@ func TestAccCockpit_WithSourceEndpoints(t *testing.T) {
})
}

func checkGrafanaURL(resourceName, projectResource string) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[projectResource]
if !ok {
return fmt.Errorf("Not found: %s", projectResource)
}

projectID := rs.Primary.ID
expectedURL := fmt.Sprintf("https://%s.dashboard.obs.fr-par.scw.cloud", projectID)

return resource.TestCheckResourceAttr(resourceName, "endpoints.0.grafana_url", expectedURL)(s)
}
}

func isCockpitDestroyed(_ *acctest.TestTools) resource.TestCheckFunc {
return func(_ *terraform.State) error {
return nil
Expand Down
Loading
Loading