Computed attributes cannot be set, but a value was set for "content" & "document_type"

Getting this error in Terraform trying to set up the SSM automation doc to remediate old access keys.
Computed attributes cannot be set, but a value was set for “document_type”.

Error: Computed attributes cannot be set
on …/modules/aws-config/access-key-rotation-automation.tf line 35, in data “aws_ssm_document” “AccessKeyRotationAutomationDoc”:
35: content = <<DOC
36: description: Automation Document For resolving a User from a ResourceId

71: DOC

Computed attributes cannot be set, but a value was set for “content”.
but content and document_type are both set in the example usage in the terraform docs.


What am I doing wrong?

Hi @chase,

The error message refers to a data "aws_ssm_document" block, which uses the aws_ssm_document data source to read an existing document

The example you shared is for a resource "aws_ssm_document" block, which declares that Terraform should create and then manage a new document.

If your intent is to have Terraform create an own an object, you can use a resource "aws_ssm_document" block instead of a data one.

Aha! Thank you! I just realized it was a data block rather than a resource block. Changing that fixed it.