Hey there,
no problemo :).
I actually think I figure out the problem. I converted policy that is generated by 'tf apply' to IAM format using regex and used AWS Policy Generator to validate it.
I removed principals and double quotes under condition, so policy looks like this now:
data "aws_iam_policy_document" "elasticsearch_access_policy_document" {
statement {
sid = "20161114001"
effect = "Allow"
"${var.sourceip}",
]
}
resources = [
"arn:aws:elasticsearch:::${var.domain_name}"
]
}
}
It would be awesome if TF Error would simply say something like: "invalid empty value in condition", that way I would know that I'm stupid and shouldn't use quotes without values :)
For some reason "principals" fails and I can't figure it why, so I'll let it go and see how far I can go without it for now.
I didn't get too far.... :D
I get problem with 'tf plan' now:
Error running plan: 1 error(s) occurred:
I assume that 'e' is the first character from my policy name but again it doesn't kind of make sense what actually is wrong here :(
and here's how my domain definition looks like:
resource "aws_elasticsearch_domain" "es" {
domain_name = "${var.domain_name}"
elasticsearch_version = "${var.elasticsearch_version}"
ebs_options {
ebs_enabled = "${var.ebs_enabled}"
volume_type = "${var.volume_type}"
volume_size = "${var.volume_size}"
}
cluster_config {
instance_type = "${var.instance_type}"
instance_count = "${var.instance_count}"
}
advanced_options {
"rest.action.multi.allow_explicit_index" = true
}
snapshot_options {
automated_snapshot_start_hour = 23
}
tags {
Domain = "${var.domain_tag}"
Managed_by = "Managed by Terraform"
}
}
Is that something more obvious to you? Maybe this is something much easier to fix? :)
As you can see I've tried using 'id' but then it's the same error just instead of complaining about "e" it complaints about "a" character :).
Any tip appreciated :)
Thank you