@@ -12,7 +12,7 @@ import (
12
12
"github.com/scaleway/terraform-provider-scaleway/v2/internal/services/cockpit"
13
13
)
14
14
15
- func TestAccCockpitSource_Basic (t * testing.T ) {
15
+ func TestAccCockpitSource_Basic_metrics (t * testing.T ) {
16
16
tt := acctest .NewTestTools (t )
17
17
defer tt .Cleanup ()
18
18
@@ -51,6 +51,45 @@ func TestAccCockpitSource_Basic(t *testing.T) {
51
51
})
52
52
}
53
53
54
+ func TestAccCockpitSource_Basic_logs (t * testing.T ) {
55
+ tt := acctest .NewTestTools (t )
56
+ defer tt .Cleanup ()
57
+
58
+ resource .ParallelTest (t , resource.TestCase {
59
+ PreCheck : func () { acctest .PreCheck (t ) },
60
+ ProviderFactories : tt .ProviderFactories ,
61
+ CheckDestroy : isSourceDestroyed (tt ),
62
+ Steps : []resource.TestStep {
63
+ {
64
+ Config : `
65
+ resource "scaleway_account_project" "project" {
66
+ name = "tf_tests_cockpit_datasource_basic"
67
+ }
68
+
69
+ resource "scaleway_cockpit_source" "main" {
70
+ project_id = scaleway_account_project.project.id
71
+ name = "my-source"
72
+ type = "logs"
73
+ }
74
+ ` ,
75
+ Check : resource .ComposeTestCheckFunc (
76
+ isSourcePresent (tt , "scaleway_cockpit_source.main" ),
77
+ resource .TestCheckResourceAttr ("scaleway_cockpit_source.main" , "name" , "my-source" ),
78
+ resource .TestCheckResourceAttr ("scaleway_cockpit_source.main" , "type" , "logs" ),
79
+ resource .TestCheckResourceAttr ("scaleway_cockpit_source.main" , "region" , "fr-par" ),
80
+ resource .TestCheckResourceAttrSet ("scaleway_cockpit_source.main" , "url" ),
81
+ resource .TestCheckResourceAttrSet ("scaleway_cockpit_source.main" , "push_url" ),
82
+ resource .TestCheckResourceAttrSet ("scaleway_cockpit_source.main" , "origin" ),
83
+ resource .TestCheckResourceAttrSet ("scaleway_cockpit_source.main" , "created_at" ),
84
+ resource .TestCheckResourceAttrSet ("scaleway_cockpit_source.main" , "updated_at" ),
85
+ resource .TestCheckResourceAttrSet ("scaleway_cockpit_source.main" , "synchronized_with_grafana" ),
86
+ resource .TestCheckResourceAttrPair ("scaleway_cockpit_source.main" , "project_id" , "scaleway_account_project.project" , "id" ),
87
+ ),
88
+ },
89
+ },
90
+ })
91
+ }
92
+
54
93
func isSourcePresent (tt * acctest.TestTools , n string ) resource.TestCheckFunc {
55
94
return func (state * terraform.State ) error {
56
95
rs , ok := state .RootModule ().Resources [n ]
0 commit comments