ovh / terraform-provider-ovh

Terraform OVH provider
https://registry.terraform.io/providers/ovh/ovh/latest/docs
Mozilla Public License 2.0
182 stars 133 forks source link

Add loadbalancer log subscription #657

Closed Tiboau closed 1 month ago

Tiboau commented 3 months ago

Manage log subscription for Loadbalancer

New Feature, add the possibility to the client to subscribe or get information about subscription

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

export OVH_CLOUD_LOADBALANCER_ID_TEST=xxxxxx export OVH_CLOUD_STREAM_ID_TEST=yyyyy

DataSource

➜  make testacc TESTARGS="-run TestAccCloudProjectLoadBalancerGetLogSubscription_basic"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run TestAccCloudProjectLoadBalancerGetLogSubscription_basic -timeout 600m -p 10
?       github.com/ovh/terraform-provider-ovh   [no test files]
?       github.com/ovh/terraform-provider-ovh/ovh/helpers   [no test files]
?       github.com/ovh/terraform-provider-ovh/ovh/types [no test files]
=== RUN   TestAccCloudProjectLoadBalancerGetLogSubscription_basic
    provider_test.go:398: Read Cloud Project /cloud/project/bad3308a4b4d4dcba4d15d5b082d7225 -> status: 'ok', desc: 'Production'
--- PASS: TestAccCloudProjectLoadBalancerGetLogSubscription_basic (12.58s)
PASS
ok      github.com/ovh/terraform-provider-ovh/ovh   12.595s
testing: warning: no tests to run
PASS
ok      github.com/ovh/terraform-provider-ovh/ovh/helpers/hashcode  (cached) [no tests to run]
make testacc TESTARGS="-run TestAccCloudProjectLoadBalancerGetLogSubscriptions_basic"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run TestAccCloudProjectLoadBalancerGetLogSubscriptions_basic -timeout 600m -p 10
?       github.com/ovh/terraform-provider-ovh   [no test files]
?       github.com/ovh/terraform-provider-ovh/ovh/helpers   [no test files]
?       github.com/ovh/terraform-provider-ovh/ovh/types [no test files]
=== RUN   TestAccCloudProjectLoadBalancerGetLogSubscriptions_basic
    provider_test.go:398: Read Cloud Project /cloud/project/bad3308a4b4d4dcba4d15d5b082d7225 -> status: 'ok', desc: 'Production'
--- PASS: TestAccCloudProjectLoadBalancerGetLogSubscriptions_basic (12.71s)
PASS
ok      github.com/ovh/terraform-provider-ovh/ovh   12.720s
testing: warning: no tests to run
PASS
ok      github.com/ovh/terraform-provider-ovh/ovh/helpers/hashcode  (cached) [no tests to run]

Resource

make testacc TESTARGS="-run TestAccCloudProjectLoadBalancerLogSubscription_basic"      
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run TestAccCloudProjectLoadBalancerLogSubscription_basic -timeout 600m -p 10
?       github.com/ovh/terraform-provider-ovh   [no test files]
?       github.com/ovh/terraform-provider-ovh/ovh/helpers   [no test files]
?       github.com/ovh/terraform-provider-ovh/ovh/types [no test files]
=== RUN   TestAccCloudProjectLoadBalancerLogSubscription_basic
    provider_test.go:398: Read Cloud Project /cloud/project/bad3308a4b4d4dcba4d15d5b082d7225 -> status: 'ok', desc: 'Production'
--- PASS: TestAccCloudProjectLoadBalancerLogSubscription_basic (12.22s)
PASS
ok      github.com/ovh/terraform-provider-ovh/ovh   12.233s
testing: warning: no tests to run
PASS
ok      github.com/ovh/terraform-provider-ovh/ovh/helpers/hashcode  0.002s [no tests to run]
➜  terraform-provider-ovh git:(add-loadbalancer-log-subscription) ✗ 

Test Configuration:

resource "ovh_cloud_project_region_loadbalancer_log_subscription" "CreateLogSubscription" { service_name = "xxxx" region_name = "yyyy" loadbalancer_id = "aaa" kind = "haproxy" stream_id = "ssss" }

data "ovh_cloud_project_region_loadbalancer_log_subscription" "sub" { service_name = "xxxx" region_name = "yyyy" loadbalancer_id = "aaa" subscription_id = ovh_cloud_project_region_loadbalancer_log_subscription.CreateLogSubscription.id }

data "ovh_cloud_project_region_loadbalancer_log_subscriptions" "subs" { service_name = "xxxx" region_name = "yyyy" loadbalancer_id = "aaa" }



# Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have made corresponding changes to the documentation
- [x] I have added acceptance tests that prove my fix is effective or that my feature works