-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a method for to convert list into str #15888
Comments
Hi @ssala7! We have a few functions that can turn lists into strings, which looks like what you need to do here. Which function you'd use depends on what format you need the resulting string to be in:
In this case it seems like data "aws_iam_policy_document" "s3_role_assume" {
statement {
effect = "Allow"
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = "${var.iam_s3_role_principal}"
}
}
}
resource "aws_iam_role" "s3_role" {
name = "${var.service}_${var.project}_role"
assume_role_policy = "${data.aws_iam_policy_document.s3_role_assume.json}"
} This approach avoids the need for any explicit conversion of the list to string, since the |
Hi again @ssala7! Since I didn't hear back from you I'm going to hope that my previous response gave you what you needed here, and close this out. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
s3_role.json
Error:
I have used jsonencode got error:
"assume_role_policy" contains an invalid JSON: invalid character 'e' after object key:value pair
Error:
unknown function called: str in:
Create a function for
str
so we can convert anything into a string.The text was updated successfully, but these errors were encountered: