Skip to content

feat: show config.toml and user data in Terraform plan #754

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Mar 22, 2023

Conversation

tmeijn
Copy link
Contributor

@tmeijn tmeijn commented Mar 17, 2023

Description

What

Adds a new variable show_user_data_in_plan which is false by default (there could be sensitive data leaked).

  • Writes the rendered config.toml to a file
  • Writes the agent's user data to a file.

Why

  • By writing the rendered config.toml to a file we get an actual diff of the config.toml when we change values in our Terraform plan. In addition this would help us with the refactoring work were currently doing.
  • Even better ability to see the impact of changes we make.

Migrations required

NO

Verification

show_user_data_in_plan = true

image

Example of config.toml showing a diff in plan:

image

@tmeijn tmeijn requested review from npalm and kayman-mk as code owners March 17, 2023 14:12
@kayman-mk
Copy link
Collaborator

Appreciated. Makes it easier to check for changes without deploying the module. Simplifies the development process.

@kayman-mk
Copy link
Collaborator

See #755 for KICS issue

@kayman-mk kayman-mk self-requested a review March 20, 2023 18:48
@tmeijn
Copy link
Contributor Author

tmeijn commented Mar 21, 2023

@kayman-mk apart from the PR linter error, this one is ready for re-review.

kayman-mk
kayman-mk previously approved these changes Mar 22, 2023
Copy link
Collaborator

@kayman-mk kayman-mk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! Makes it very easy to check for configuration changes.

@kayman-mk
Copy link
Collaborator

Tested an upgrade from 6.1.2 to this version. Looks good.

@kayman-mk kayman-mk changed the title feat: show runner config.toml in Terraform plan feat: show config.toml and user data in Terraform plan Mar 22, 2023
@kayman-mk kayman-mk merged commit 5b5c335 into cattle-ops:main Mar 22, 2023
kayman-mk pushed a commit that referenced this pull request Mar 22, 2023
🤖 I have created a release *beep* *boop*
---


##
[6.2.0](6.1.2...6.2.0)
(2023-03-22)


### Features

* show `config.toml` and user data in Terraform plan
([#754](#754))
([5b5c335](5b5c335))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Signed-off-by: Niek Palm <[email protected]>
Co-authored-by: cattle-ops-releaser[bot] <126345536+cattle-ops-releaser[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
kayman-mk added a commit that referenced this pull request May 3, 2023
## Description

In #754 I unfortunately made a major oversight: the `local_file` doesn't
persist between machines (duh 🤦🏾 ). So for example in a CI/CD pipeline
the file is not present so it wants to render the whole file as new
every time. This defeats the main purpose that I had intended for this
feature... Also if the pipeline applies the plan, there will be a
perpetual diff, even if you save the file in repository.

I still think this is useful locally for debugging purposes, but
therefore I propose we disable this mechanism by default. In addition,
when these variables are enabled I changed the location to the Root
module for easier access if you want to debug the rendered files.

## Migrations required

YES/NO - Feature is quite new, if someone wants to use keep this as
introduced they now need to explicitly enable it.

## Verification

```hcl
output_runner_config_to_file = true
output_user_data_to_file     = true
```

Results:


![image](https://user-images.githubusercontent.com/17970041/227529895-864e45e0-70aa-4b23-a725-30c4cea8b955.png)

---------

Co-authored-by: kayma <[email protected]>
Co-authored-by: Matthias Kay <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants