I am currently working on sharing AWS Systems Manager (SSM) documents with multiple AWS accounts using Terraform. While attempting to add permissions for multiple AWS accounts, I encountered an error that I am seeking assistance with.
The specific error message I encountered is as follows:
on clone-efs-folder.tf line 18, in resource “aws_ssm_document” “clone_efstos3”:
18: permissions = {
19: type = “Share”
20: account_ids = [“13323xxxxx”,“2323xxxxx”]
21: }
Inappropriate value for attribute “permissions”: element “account_ids”:
string required.
I understand that the error is related to the "account_ids" attribute within the "permissions" block. It seems that providing multiple AWS account IDs as an array is not being recognized correctly. If I just give one AWS account id it works fine.
Could you kindly assist me in resolving this issue and guide me on the appropriate way to add permissions for multiple AWS accounts using the "aws_ssm_document" resource in Terraform?
Here's the snippet of my code
resource "aws_ssm_document" "clone_efstos3" {
name = "${var.orgid}-clone-efstos3"
document_type = "Automation"
document_format = "JSON"
permissions = {
type = "Share"
account_ids = ["324232xxxx","22323xxxxx"]
}
content = templatefile("${path.module}/templates/clone_efstos3.json", {
})
}