olibruno
olibruno

Reputation: 51

load policy.json file in terraform

I have my EKS specific user configuration in a json file that I want to load into terraform to apply it.

I use the data_source aws_iam_policy_document

resource "aws_iam_policy_document" "ops_manager" {                                                                                                       
policy = file("templates/eks_user_policy.json")         
    } 

Unfortunately when i run terraform plan i got this:

The provider provider.aws does not support resource type
"aws_iam_policy_document".

terraform version: v0.14.9

Upvotes: 2

Views: 7858

Answers (2)

olibruno
olibruno

Reputation: 51

The problem was that in the JSON file there was a comment "//". By deleting the comment the problem was solved. maybe it help someone .

Upvotes: 0

Marcin
Marcin

Reputation: 238081

aws_iam_policy_document is a data source, not a resource.

Probably you want aws_iam_policy:

resource "aws_iam_policy" "ops_manager" {                                                                                                       
    policy = file("templates/eks_user_policy.json")         
} 

Upvotes: 5

Related Questions