In addition to client_authentication possible via tls there is no option provided for SASL/SCRAM based client_authentication in aws_msk_cluster resource. Additionally, there are no/selective resources available for the list of operations possible for kafka (AWS MSK) as mentioned in the reference below.
I am specifically looking for batch-associate-scram-secret operation to enable SASL/SCRAM based authentication via terraform.
Possible option for SASL/SCRAM based authentication can be as follows for the client_authentication Argument Reference
```
resource "aws_msk_cluster" "example" {
cluster_name = "example"
kafka_version = "2.4.1"
number_of_broker_nodes = 3
broker_node_group_info {
instance_type = "kafka.m5.large"
ebs_volume_size = 1000
client_subnets = [
aws_subnet.subnet_az1.id,
aws_subnet.subnet_az2.id,
aws_subnet.subnet_az3.id,
]
security_groups = [aws_security_group.sg.id]
}
client_authentication {
sasl {
secretArnList = [aws_secretsmanager_secret.example-1.arn, aws_secretsmanager_secret.example-2.arn]
}
}
encryption_info {
encryption_at_rest_kms_key_arn = aws_kms_key.kms.arn
}
open_monitoring {
prometheus {
jmx_exporter {
enabled_in_broker = true
}
node_exporter {
enabled_in_broker = true
}
}
}
```
Related (enabling SASL/SCRAM on aws_msk_cluster):
The SCRAM secret will need to be a new resource.
It looks like #15302 will address both.
Any news so far?
Hi @dishantkamble et al. 馃憢 dropping a note here that we've just merged in (PR #15302) sasl/scram authentication support in the msk_cluster resource in addition to adding a new resource, namely aws_msk_scram_secret_association for associating secrets with an MSK cluster. These additions will be in v3.18.0 of the Terraform AWS Provider, expected out later today.
sasl/scram auth can be enabled by configuring your resource cluster such as:
resource "aws_msk_cluster" "example" {
# ... other configuration ...
client_authentication {
sasl {
scram = true
}
}
and secrets can be associated with something like:
resource "aws_msk_scram_secret_association" "example" {
cluster_arn = aws_msk_cluster.test.arn
secret_arn_list = [aws_secretsmanager_secret.example1.arn, aws_secretsmanager_secret.example2.arn]
}
a more detailed example is available in https://github.com/hashicorp/terraform-provider-aws/blob/master/website/docs/r/msk_scram_secret_association.html.markdown
This has been released in version 3.18.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!