saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
13.98k stars 5.47k forks source link

[BUG] Special characters returned by cmd.run state #66535

Closed AGirin closed 1 month ago

AGirin commented 1 month ago

Description Running terraform commands from salt state. Getting output similar to this:

?[0m?[1mdata.aws_iam_policy_document.assume-from-iam-account: Reading...?[0m?[0m
                  ?[0m?[1mdata.aws_caller_identity.current: Reading...?[0m?[0m
                  ?[0m?[1mdata.aws_iam_policy_document.assume-from-iam-account: Read complete after 0s [id=3203618795]?[0m
                  ?[0m?[1mdata.aws_caller_identity.current: Read complete after 0s [id=xxxxxxxxxx]?[0m

                  Terraform used the selected providers to generate the following execution
                  plan. Resource actions are indicated with the following symbols:
                    ?[32m+?[0m create?[0m

                  Terraform will perform the following actions:

                  ?[1m  # aws_iam_role.this?[0m will be created
                  ?[0m  ?[32m+?[0m?[0m resource "aws_iam_role" "this" {
                        ?[32m+?[0m?[0m arn                   = (known after apply)
                        ?[32m+?[0m?[0m assume_role_policy    = jsonencode(...

Is it possible to change output to stop showing those ?[32m+?[0m?[0m special characters?

I can run the same command from the cli with --out=newline_values_only and it shows output without special characters.

Thanks,

Andrew

AGirin commented 1 month ago

Answered my own question. Add -no-color to terraform command...