Skip to content

acl credentials are updated on every deploy #54

@ColdFire87

Description

Hi,

I am experiencing an issue, where ACLs are updated in-place on every deployment. The only thing that changes is the credentials block.
The credentials are being picked up from the environment (CI secrets) and don't change. The way I got around the issue was to ignore the changes to credentials using the lifecycle option.

image

terraform {
  required_version = "= 1.2.3"

  backend "s3" {}

  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "4.19.0"
    }

    confluent = {
      source  = "confluentinc/confluent"
      version = "0.11.0"
    }
  }
}
# Provision ACLs
resource "confluent_kafka_acl_v3" "acl" {
  # Used for interacting with Confluent Cloud Kafka cluster
  credentials {
    key    = var.confluentcloud_api_key
    secret = var.confluentcloud_api_secret
  }

  # The host for the ACL. Should be set to * for Confluent Cloud
  host = "*"

  # Iterate over ACLs
  for_each = { for acl in var.acls : acl.tf_key => acl }

  # Give or deny permission
  permission = each.value.permission
  operation  = each.value.operation

  # On a resource (usually a topic or a group), with name starting with ${each.value.resource_name}
  resource_type = each.value.resource_type
  resource_name = each.value.resource_name
  pattern_type  = each.value.pattern_type

  # In a Kafka cluster
  rest_endpoint = local.cc_kafka_clusters[var.locale][var.environment].endpoint
  kafka_cluster {
    id = local.cc_kafka_clusters[var.locale][var.environment].cluster_id
  }

  # To service account
  principal = format("User:%s", confluent_service_account_v2.principal.id)

  # Prevent the credentials being changed on subsequent runs
  lifecycle {
    ignore_changes = [credentials]
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions