Skip to content

Resolve terraform drift due to whitespace changes #25340

Open
@anyi1985

Description

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

0.13.7
Provider “aws” (~> 4.0)

Affected Resource(s)

aws_ssm_document

Terraform Configuration Files

resource "aws_ssm_document" "ssm_prefs" {
  name            = "SSM-SessionManagerRunShell"
  document_type   = "Session"
  document_format = "JSON"
  tags = {
    scp-protect = "true"
  }

  content = <<DOC
{
    "schemaVersion": "1.0",
    "description": "Document to hold regional settings for Session Manager",
    "sessionType": "Standard_Stream",
    "inputs": {
        "cloudWatchLogGroupName": "${var.cloudwatch_log_group_name}-${local.region}",
        "cloudWatchEncryptionEnabled": "true"
    }
}
DOC
}

Debug Output

Expected Behavior

There should be no drift/changes such as whitespace since I am making no changes.
Plan: 0 to add, 0 to change, 0 to destroy.

Actual Behavior

'terraform plan' gives:

module.cloud-core-settings-us-east-2.aws_ssm_document.ssm_prefs will be updated in-place
~ resource "aws_ssm_document" "ssm_prefs" {
       arn = "arn:aws:ssm:us-east-2:xxxxxxxxxxxx:document/SSM-SessionManagerRunShell"
          ~ content = jsonencode( # whitespace changes

Metadata

Assignees

No one assigned

    Labels

    bugAddresses a defect in current functionality.service/ssmIssues and PRs that pertain to the ssm service.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions