IBM-Cloud / terraform-provider-ibm

https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs
Mozilla Public License 2.0
339 stars 659 forks source link

How to upgrade LogDNA Agent version in k8s cluster using Terraform? #4783

Open uday644 opened 11 months ago

uday644 commented 11 months ago

We have the IKS Clusters where LogDNA agent is installed using Terraform code. Currently 2.2.8 version of LogDNA agent is installed, We do re-built the Non-Prod clusters daily, Still the agent is not upgraded to the latest version. We can't fine any attribute in Terraform resource to control version of this agent.

Please help us knowing how we can achieve this using Terraform.

Below is the code we used for the agent deployment.

resource "ibm_resource_instance" "logdna_instance" {
    name     = "${var.resource_group}_log_dna"
    service  = "logdna"
    plan     = "7-day"
    location = "eu-gb"
    service_endpoints = "private"
    resource_group_id = var.resource_group_id
    lifecycle {
      prevent_destroy = true
    }
}

resource "ibm_resource_key" "logdna_resource_key" {
  name                 = "${var.resource_group}_logdna_resource_key"
  resource_instance_id = ibm_resource_instance.logdna_instance.id
  role                 = "Manager"
  parameters = {service-endpoints = "private"}
  depends_on = [ibm_resource_instance.logdna_instance]
  lifecycle {
    prevent_destroy = true
  }
}

resource "ibm_ob_logging" "logdna_deployment" {
  cluster = var.cluster_name
  instance_id = ibm_resource_instance.logdna_instance.guid
  private_endpoint = true
  depends_on = [
    ibm_resource_key.logdna_resource_key
  ]
}
daniel-butler-irl commented 11 months ago

AFAIK an agent update is not possible with the provider. My team provides the following module to help with this https://github.com/terraform-ibm-modules/terraform-ibm-observability-agents

uday644 commented 11 months ago

Thanks for the reply.

Inside the module I can see it is using VPC Cluster (ibm_container_vpc_cluster), our infra is using the classic cluster. Is there any module available to support the classic cluster (ibm_container_cluster) ?

daniel-butler-irl commented 11 months ago

Please open a feature request for classic support and we can investigate, Thanks. https://github.com/terraform-ibm-modules/terraform-ibm-observability-agents/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.md

We also accept Pull requests, so if you want to add support yourself that would be cool too 👍

uday644 commented 11 months ago

https://github.com/terraform-ibm-modules/terraform-ibm-observability-agents -> Is this module only compatible with the Open Shift cluster?