-
Notifications
You must be signed in to change notification settings - Fork 132
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
iam: unable to define roles inline policy #170
Comments
Hi @mcanevet thanks for raising this issue, could you please give more details (examples, expected behavior etc.) to clarify the problem |
@turkenf sure, here is an example (from terraform documentation) of what is possible with Terraform, but not with the Crossplane AWS provider: resource "aws_iam_role_policy" "test_policy" {
name = "test_policy"
role = aws_iam_role.test_role.id
# Terraform's "jsonencode" function converts a
# Terraform expression result to valid JSON syntax.
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Action = [
"ec2:Describe*",
]
Effect = "Allow"
Resource = "*"
},
]
})
}
resource "aws_iam_role" "test_role" {
name = "test_role"
assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Action = "sts:AssumeRole"
Effect = "Allow"
Sid = ""
Principal = {
Service = "ec2.amazonaws.com"
}
},
]
})
} Declaring Role inline policy is not possible, only attaching a customer managed policy. |
This resource is in our skip list: https://github.com/upbound/provider-aws/blob/024487cd13e9a84573cb1e842fd1705acfba4448/config/provider.go#L120 |
@turkenf in Terraform you can define an inline policy by either use the Modifying the line you points should allow the usage of the first method, but to enable the second method we should probably modify this line: I don't know what the provider policy when you have 2 possibilities to do the same thing in Terraform. Should we allow both or prefer one over the other? |
Community provider has the same issue: crossplane-contrib/provider-aws#177 |
Comment mentions that this resource is "identical with aws_iam_*_policy_attachment resources.", but it is actually not true:
It is usual TF approach. For example:
Of course both methods should be available. In some cases (for example corporate security policies/bureaucracy) empty roles can be pre-provisioned separately and Crossplane will only manage inlinePolicy. |
I was going to raise this today... It seems that but not part of the |
What happened?
Here is a retranscription of the discussion we had on Slack with @ulucinar:
How can we reproduce it?
What environment did it happen in?
The text was updated successfully, but these errors were encountered: