{"id":13505874,"url":"https://github.com/cloudposse-archives/tfmask","last_synced_at":"2025-04-09T20:13:40.141Z","repository":{"id":35971134,"uuid":"166764658","full_name":"cloudposse-archives/tfmask","owner":"cloudposse-archives","description":"Terraform utility to mask select output from `terraform plan` and `terraform apply`","archived":false,"fork":false,"pushed_at":"2023-12-15T05:22:57.000Z","size":29,"stargazers_count":204,"open_issues_count":21,"forks_count":27,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-09T20:13:34.107Z","etag":null,"topics":["mask","masking","regex","security","terraform","terraform-plans","terrahelp"],"latest_commit_sha":null,"homepage":"https://cloudposse.com/accelerate","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudposse-archives.png","metadata":{"funding":{"github":"cloudposse"},"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-01-21T07:04:51.000Z","updated_at":"2025-03-01T11:34:29.000Z","dependencies_parsed_at":"2023-12-15T06:42:39.916Z","dependency_job_id":null,"html_url":"https://github.com/cloudposse-archives/tfmask","commit_stats":null,"previous_names":["cloudposse-archives/tfmask","cloudposse/tfmask"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudposse-archives%2Ftfmask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudposse-archives%2Ftfmask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudposse-archives%2Ftfmask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudposse-archives%2Ftfmask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudposse-archives","download_url":"https://codeload.github.com/cloudposse-archives/tfmask/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103872,"owners_count":21048245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mask","masking","regex","security","terraform","terraform-plans","terrahelp"],"created_at":"2024-08-01T00:01:15.972Z","updated_at":"2025-04-09T20:13:40.118Z","avatar_url":"https://github.com/cloudposse-archives.png","language":"Go","funding_links":["https://github.com/sponsors/cloudposse"],"categories":["Go","Tools"],"sub_categories":["Community providers"],"readme":"# tfmask [![Build Status](https://travis-ci.org/cloudposse/tfmask.svg?branch=master)](https://travis-ci.org/cloudposse/tfmask) [![Latest Release](https://img.shields.io/github/release/cloudposse/tfmask.svg)](https://github.com/cloudposse/tfmask/releases/latest) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)\n\n[![README Header][readme_header_img]][readme_header_link]\n\n[![Cloud Posse][logo]](https://cpco.io/homepage)\n\n\u003c!--\n\n\n\n\n  ** DO NOT EDIT THIS FILE\n  **\n  ** This file was automatically generated by the `build-harness`.\n  ** 1) Make all changes to `README.yaml`\n  ** 2) Run `make init` (you only need to do this once)\n  ** 3) Run`make readme` to rebuild this file.\n  **\n  ** (We maintain HUNDREDS of open source projects. This is how we maintain our sanity.)\n  **\n\n\n\n\n\n--\u003e\n\nCommand line utility to mask sensitive output from a `transform plan` or `terraform apply`.\n\n\n---\n\nThis project is part of our comprehensive [\"SweetOps\"](https://cpco.io/sweetops) approach towards DevOps.\n[\u003cimg align=\"right\" title=\"Share via Email\" src=\"https://docs.cloudposse.com/images/ionicons/ios-email-outline-2.0.1-16x16-999999.svg\"/\u003e][share_email]\n[\u003cimg align=\"right\" title=\"Share on Google+\" src=\"https://docs.cloudposse.com/images/ionicons/social-googleplus-outline-2.0.1-16x16-999999.svg\" /\u003e][share_googleplus]\n[\u003cimg align=\"right\" title=\"Share on Facebook\" src=\"https://docs.cloudposse.com/images/ionicons/social-facebook-outline-2.0.1-16x16-999999.svg\" /\u003e][share_facebook]\n[\u003cimg align=\"right\" title=\"Share on Reddit\" src=\"https://docs.cloudposse.com/images/ionicons/social-reddit-outline-2.0.1-16x16-999999.svg\" /\u003e][share_reddit]\n[\u003cimg align=\"right\" title=\"Share on LinkedIn\" src=\"https://docs.cloudposse.com/images/ionicons/social-linkedin-outline-2.0.1-16x16-999999.svg\" /\u003e][share_linkedin]\n[\u003cimg align=\"right\" title=\"Share on Twitter\" src=\"https://docs.cloudposse.com/images/ionicons/social-twitter-outline-2.0.1-16x16-999999.svg\" /\u003e][share_twitter]\n\n\n\n\nIt's 100% Open Source and licensed under the [APACHE2](LICENSE).\n\n\n\n\n\n\n\n\n\n\n\n## Screenshots\n\n\n![terraform plan](https://user-images.githubusercontent.com/52489/51474936-c1003800-1d35-11e9-9e25-11245388a372.png)\n*Example of masking output from a `terraform plan` execution*\n![terraform apply](https://user-images.githubusercontent.com/52489/51475052-248a6580-1d36-11e9-9f55-5ad46bf77bcb.png)\n*Example of masking output from a `terraform apply` execution*\n\n\n## Introduction\n\n\nIf you answer \"yes\" to any of these questions, then look no further!\n\n* Have you ever wished you could easily filter sensitive output from a `terraform plan` or `terraform apply`?\n* Do you use terraform providers that leak sensitive data to `stdout` (e.g. `terraform-github-provider`)?\n\n**Yes?** Great! Then this utility is for you.\n\nThe `tfmask` utility will replace the \"old value\" and the \"new value\" with the masking character (e.g. `*`).\n  \n__NOTE__: `tfmask` will preserve the name of the nodes in the graph\n\n## Usage\n\n\n\n\n__NOTE__: The utility supports a number of configuration settings which can be passed via environment variables.\n\n| Environment Variable     | Description                                    | Default    |\n|--------------------------|------------------------------------------------|------------| \n| `TFMASK_CHAR`            | Character used to mask all output              | `*`        |\n| `TFMASK_VALUES_REGEX`    | Regular expression used to match values        | [see code] | \n| `TFMASK_RESOURCES_REGEX` | Regular expression used to match resources     | [see code] |\n\n__IMPORTANT__: Pass `-no-color` to `terraform plan` and `terraform apply` for proper parsing\n\nThe basic usage looks like this. We're going to run `terraform plan` and filter it through `tfmask`:\n\n```sh\nterraform plan -no-color | tfmask\n```\n\n### Direnv\n\nYou can use `tfmask` with [`direnv`](https://direnv.net/) to set the defaults.\n\nExample `.envrc`:\n\n```sh\n# Export terraform environment\nexport TFMASK_CHAR=\"#\"\nexport TFMASK_VALUES_REGEX=\"(?i)^.*[^a-zA-Z](oauth|secret|token|password|key|result|id).*$\"\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003eExample of Masked Output\u003c/summary\u003e\n\n  ```sh\n  Terraform will perform the following actions:\n\n    ~ module.atlantis.module.web_app.module.ecs_codepipeline.aws_codepipeline.source_build_deploy\n        stage.0.action.0.configuration.%:          \"4\" =\u003e \"5\"\n        stage.0.action.0.configuration.OAuthToken: \"\" =\u003e \"*******************************************\"\n\n  Plan: 0 to add, 1 to change, 0 to destroy.\n  ```\n\u003c/details\u003e\n\n\n\n\n## Examples\n\n\n### Compiling the Binary\n\n```sh\nmake go/build\n```\n\n ### Use with Terraform Plan\n\n Many terraform providers unintentionally leak sensitive information when running `terraform plan`. **This is very bad.**\n\n\u003cdetails\u003e\n  \u003csummary\u003eExample of a Leaked Secret from a Terraform Plan\u003c/summary\u003e\n\n  ```sh\n  An execution plan has been generated and is shown below.\n  Resource actions are indicated with the following symbols:\n    ~ update in-place\n\n  Terraform will perform the following actions:\n\n    ~ module.example.aws_codepipeline.source_build_deploy\n        stage.0.action.0.configuration.%:          \"4\" =\u003e \"5\"\n        stage.0.action.0.configuration.OAuthToken: \"\" =\u003e \"efba05dbe9b94ba18ae3737a6d6de16eefba05dbe9b9\"\n  Plan: 0 to add, 1 to change, 0 to destroy.\n  ```\n  __NOTE:__ This `OAuthToken` is just an example and not a valid token.\n\u003c/details\u003e\n\n\nUsing `tfmask`, the output from `terraform plan` will be masked like this:\n\n```sh\nterraform plan -no-color | tfmask\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003eExample of Masked Terraform Plan Output\u003c/summary\u003e\n\n  ```\n   An execution plan has been generated and is shown below.\n  Resource actions are indicated with the following symbols:\n    ~ update in-place\n\n  Terraform will perform the following actions:\n\n    ~ module.example.aws_codepipeline.source_build_deploy\n        stage.0.action.0.configuration.%:          \"4\" =\u003e \"5\"\n        stage.0.action.0.configuration.OAuthToken: \"\" =\u003e ********************************************\"\n  Plan: 0 to add, 1 to change, 0 to destroy.\n  ```\n\u003c/details\u003e\n\n### Use with Terraform Apply\n\nMany terraform providers unintentionally leak sensitive information when running `terraform apply`. **This is very bad.**\n\n\u003cdetails\u003e\n  \u003csummary\u003eExample of a Leaked Secret from a Terraform Apply\u003c/summary\u003e\n\n  ```sh\n  terraform apply\n  module.example.aws_codepipeline.source_build_deploy: Modifying... (ID: example-codepipeline)\n    stage.0.action.0.configuration.%:          \"4\" =\u003e \"5\"\n    stage.0.action.0.configuration.OAuthToken: \"\" =\u003e \"efba05dbe9b94ba18ae3737a6d6de16eefba05dbe9b9\"\n  module.example.aws_codepipeline.source_build_deploy: Modifications complete after 1s (ID: example-codepipeline)\n\n  Apply complete! Resources: 0 added, 1 changed, 0 destroyed.\n  ```\n\n  __NOTE:__ This `OAuthToken` is just an example and not a valid token.\n\u003c/details\u003e\n\nUsing `tfmask`, the output from `terraform apply` will be masked like this:\n\n```sh\nterraform apply -no-color | tfmask\n```\n\u003cdetails\u003e\n  \u003csummary\u003eExample of Masked Terraform Apply Output\u003c/summary\u003e\n\n  ```sh\n  module.example.aws_codepipeline.source_build_deploy: Modifying... (ID: example-codepipeline)\n    stage.0.action.0.configuration.%:          \"4\" =\u003e \"5\"\n    stage.0.action.0.configuration.OAuthToken: \"\" =\u003e \"********************************************\"                                                 \n  module.example.aws_codepipeline.source_build_deploy: Modifications complete after 1s (ID: example-codepipeline)\n\n  Apply complete! Resources: 0 added, 1 changed, 0 destroyed.\n  ```\n\u003c/details\u003e\n\n\n\n\n\n## Share the Love\n\nLike this project? Please give it a ★ on [our GitHub](https://github.com/cloudposse/tfmask)! (it helps us **a lot**)\n\nAre you using this project or any of our other projects? Consider [leaving a testimonial][testimonial]. =)\n\n\n## Related Projects\n\nCheck out these related projects.\n\n- [Packages](https://github.com/cloudposse/packages) - Cloud Posse installer and distribution of native apps\n- [build-harness](https://github.com/cloudposse/build-harness) - Collection of Makefiles to facilitate building Golang projects, Dockerfiles, Helm charts, and more\n- [geodesic](https://github.com/cloudposse/geodesic) - Geodesic is the fastest way to get up and running with a rock solid, production grade cloud platform built on strictly Open Source tools.\n- [direnv](https://direnv.net/) - Unclutter your .profile with an environment switcher for the shell\n- [tfenv](https://github.com/cloudposse/tfenv) - Transform environment variables for use with Terraform (e.g.  `HOSTNAME` ⇨ `TF_VAR_hostname`)\n\n\n\n## Help\n\n**Got a question?** We got answers.\n\nFile a GitHub [issue](https://github.com/cloudposse/tfmask/issues), send us an [email][email] or join our [Slack Community][slack].\n\n[![README Commercial Support][readme_commercial_support_img]][readme_commercial_support_link]\n\n## DevOps Accelerator for Startups\n\n\nWe are a [**DevOps Accelerator**][commercial_support]. We'll help you build your cloud infrastructure from the ground up so you can own it. Then we'll show you how to operate it and stick around for as long as you need us.\n\n[![Learn More](https://img.shields.io/badge/learn%20more-success.svg?style=for-the-badge)][commercial_support]\n\nWork directly with our team of DevOps experts via email, slack, and video conferencing.\n\nWe deliver 10x the value for a fraction of the cost of a full-time engineer. Our track record is not even funny. If you want things done right and you need it done FAST, then we're your best bet.\n\n- **Reference Architecture.** You'll get everything you need from the ground up built using 100% infrastructure as code.\n- **Release Engineering.** You'll have end-to-end CI/CD with unlimited staging environments.\n- **Site Reliability Engineering.** You'll have total visibility into your apps and microservices.\n- **Security Baseline.** You'll have built-in governance with accountability and audit logs for all changes.\n- **GitOps.** You'll be able to operate your infrastructure via Pull Requests.\n- **Training.** You'll receive hands-on training so your team can operate what we build.\n- **Questions.** You'll have a direct line of communication between our teams via a Shared Slack channel.\n- **Troubleshooting.** You'll get help to triage when things aren't working.\n- **Code Reviews.** You'll receive constructive feedback on Pull Requests.\n- **Bug Fixes.** We'll rapidly work with you to fix any bugs in our projects.\n\n## Slack Community\n\nJoin our [Open Source Community][slack] on Slack. It's **FREE** for everyone! Our \"SweetOps\" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build totally *sweet* infrastructure.\n\n## Discourse Forums\n\nParticipate in our [Discourse Forums][discourse]. Here you'll find answers to commonly asked questions. Most questions will be related to the enormous number of projects we support on our GitHub. Come here to collaborate on answers, find solutions, and get ideas about the products and services we value. It only takes a minute to get started! Just sign in with SSO using your GitHub account.\n\n## Newsletter\n\nSign up for [our newsletter][newsletter] that covers everything on our technology radar.  Receive updates on what we're up to on GitHub as well as awesome new projects we discover.\n\n## Office Hours\n\n[Join us every Wednesday via Zoom][office_hours] for our weekly \"Lunch \u0026 Learn\" sessions. It's **FREE** for everyone!\n\n[![zoom](https://img.cloudposse.com/fit-in/200x200/https://cloudposse.com/wp-content/uploads/2019/08/Powered-by-Zoom.png\")][office_hours]\n\n## Contributing\n\n### Bug Reports \u0026 Feature Requests\n\nPlease use the [issue tracker](https://github.com/cloudposse/tfmask/issues) to report any bugs or file feature requests.\n\n### Developing\n\nIf you are interested in being a contributor and want to get involved in developing this project or [help out](https://cpco.io/help-out) with our other projects, we would love to hear from you! Shoot us an [email][email].\n\nIn general, PRs are welcome. We follow the typical \"fork-and-pull\" Git workflow.\n\n 1. **Fork** the repo on GitHub\n 2. **Clone** the project to your own machine\n 3. **Commit** changes to your own branch\n 4. **Push** your work back up to your fork\n 5. Submit a **Pull Request** so that we can review your changes\n\n**NOTE:** Be sure to merge the latest changes from \"upstream\" before making a pull request!\n\n\n## Copyright\n\nCopyright © 2017-2020 [Cloud Posse, LLC](https://cpco.io/copyright)\n\n\n\n## License\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\nSee [LICENSE](LICENSE) for full details.\n\n    Licensed to the Apache Software Foundation (ASF) under one\n    or more contributor license agreements.  See the NOTICE file\n    distributed with this work for additional information\n    regarding copyright ownership.  The ASF licenses this file\n    to you under the Apache License, Version 2.0 (the\n    \"License\"); you may not use this file except in compliance\n    with the License.  You may obtain a copy of the License at\n\n      https://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing,\n    software distributed under the License is distributed on an\n    \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n    KIND, either express or implied.  See the License for the\n    specific language governing permissions and limitations\n    under the License.\n\n\n\n\n\n\n\n\n\n## Trademarks\n\nAll other trademarks referenced herein are the property of their respective owners.\n\n## About\n\nThis project is maintained and funded by [Cloud Posse, LLC][website]. Like it? Please let us know by [leaving a testimonial][testimonial]!\n\n[![Cloud Posse][logo]][website]\n\nWe're a [DevOps Professional Services][hire] company based in Los Angeles, CA. We ❤️  [Open Source Software][we_love_open_source].\n\nWe offer [paid support][commercial_support] on all of our projects.\n\nCheck out [our other projects][github], [follow us on twitter][twitter], [apply for a job][jobs], or [hire us][hire] to help with your cloud strategy and implementation.\n\n\n\n### Contributors\n\n|  [![Erik Osterman][osterman_avatar]][osterman_homepage]\u003cbr/\u003e[Erik Osterman][osterman_homepage] |\n|---|\n\n\n  [osterman_homepage]: https://github.com/osterman\n  [osterman_avatar]: https://img.cloudposse.com/150x150/https://github.com/osterman.png\n\n[![README Footer][readme_footer_img]][readme_footer_link]\n[![Beacon][beacon]][website]\n\n  [logo]: https://cloudposse.com/logo-300x69.svg\n  [docs]: https://cpco.io/docs?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=cloudposse/tfmask\u0026utm_content=docs\n  [website]: https://cpco.io/homepage?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=cloudposse/tfmask\u0026utm_content=website\n  [github]: https://cpco.io/github?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=cloudposse/tfmask\u0026utm_content=github\n  [jobs]: https://cpco.io/jobs?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=cloudposse/tfmask\u0026utm_content=jobs\n  [hire]: https://cpco.io/hire?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=cloudposse/tfmask\u0026utm_content=hire\n  [slack]: https://cpco.io/slack?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=cloudposse/tfmask\u0026utm_content=slack\n  [linkedin]: https://cpco.io/linkedin?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=cloudposse/tfmask\u0026utm_content=linkedin\n  [twitter]: https://cpco.io/twitter?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=cloudposse/tfmask\u0026utm_content=twitter\n  [testimonial]: https://cpco.io/leave-testimonial?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=cloudposse/tfmask\u0026utm_content=testimonial\n  [office_hours]: https://cloudposse.com/office-hours?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=cloudposse/tfmask\u0026utm_content=office_hours\n  [newsletter]: https://cpco.io/newsletter?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=cloudposse/tfmask\u0026utm_content=newsletter\n  [discourse]: https://ask.sweetops.com/?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=cloudposse/tfmask\u0026utm_content=discourse\n  [email]: https://cpco.io/email?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=cloudposse/tfmask\u0026utm_content=email\n  [commercial_support]: https://cpco.io/commercial-support?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=cloudposse/tfmask\u0026utm_content=commercial_support\n  [we_love_open_source]: https://cpco.io/we-love-open-source?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=cloudposse/tfmask\u0026utm_content=we_love_open_source\n  [terraform_modules]: https://cpco.io/terraform-modules?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=cloudposse/tfmask\u0026utm_content=terraform_modules\n  [readme_header_img]: https://cloudposse.com/readme/header/img\n  [readme_header_link]: https://cloudposse.com/readme/header/link?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=cloudposse/tfmask\u0026utm_content=readme_header_link\n  [readme_footer_img]: https://cloudposse.com/readme/footer/img\n  [readme_footer_link]: https://cloudposse.com/readme/footer/link?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=cloudposse/tfmask\u0026utm_content=readme_footer_link\n  [readme_commercial_support_img]: https://cloudposse.com/readme/commercial-support/img\n  [readme_commercial_support_link]: https://cloudposse.com/readme/commercial-support/link?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=cloudposse/tfmask\u0026utm_content=readme_commercial_support_link\n  [share_twitter]: https://twitter.com/intent/tweet/?text=tfmask\u0026url=https://github.com/cloudposse/tfmask\n  [share_linkedin]: https://www.linkedin.com/shareArticle?mini=true\u0026title=tfmask\u0026url=https://github.com/cloudposse/tfmask\n  [share_reddit]: https://reddit.com/submit/?url=https://github.com/cloudposse/tfmask\n  [share_facebook]: https://facebook.com/sharer/sharer.php?u=https://github.com/cloudposse/tfmask\n  [share_googleplus]: https://plus.google.com/share?url=https://github.com/cloudposse/tfmask\n  [share_email]: mailto:?subject=tfmask\u0026body=https://github.com/cloudposse/tfmask\n  [beacon]: https://ga-beacon.cloudposse.com/UA-76589703-4/cloudposse/tfmask?pixel\u0026cs=github\u0026cm=readme\u0026an=tfmask\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudposse-archives%2Ftfmask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudposse-archives%2Ftfmask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudposse-archives%2Ftfmask/lists"}