SSM association invalid parameter and no target

0

I have created a document, Iam and Association using terraform. The purpose of my code is to auto execute a script that describes ec2 instances.

After I run my code the document and association are successfully created but My association is failing in the aws console with the error invalid parameter and it also shows no target in the console. If I manually make an association using the document I created with my code it is totally fine

I do have a ssm_automation role and a policy to allow EC2 to all resources. This is my association code:

resource "aws_ssm_association" "testabc" { name = aws_ssm_document.test.name schedule_expression = "cron(0 11 0 ? * * *)" automation_target_parameter_name = "targets"

parameters = { AutomationAssumeRole = aws_iam_role.ssm_automation_roletest.arn } targets { key = "aws:NoOpAutomationTag" values = ["AWS-NoOpAutomationTarget-Value"] } }

in my document I do have a parameters: AutomationAssumeRole: type: String description: default: "${aws_iam_role.ssm_automation_role.arn}"

How do I fix this problem. Should my document have an another pararmeter for an instance id?? Should I have an additional policy on the Iam role for SSM for EC2??

asked 7 months ago70 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions