Skip to content
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

add Terraform wrapper types to generate docs with default value #203

Conversation

maksym-nazarenko
Copy link
Collaborator

This PR introduces wrapper types to generate Terraform docs with default value.
It is a drop-in replacement implemented as function.
To enable this feature, just wrap attribute in schema with proper typed wrapper:

"address_pool": defaultaware.StringAttribute(
	schema.StringAttribute{
		Optional:    true,
		Computed:    true,
		Default:     stringdefault.StaticString("static-only"),
		Description: "IP pool, from which to take IP addresses for the clients. If set to static-only, then only the clients that have a static lease (added in lease submenu) will be allowed.",
	},
),

and next run of make generate will generate documentation with Default: .... suffix.

Copy link
Owner

@ddelnano ddelnano left a comment

Choose a reason for hiding this comment

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

Glad to see that there is a way to support this until upstream handles this better. Thanks for figuring this out!

@maksym-nazarenko maksym-nazarenko merged commit 77c5535 into ddelnano:master Sep 20, 2023
4 checks passed
@maksym-nazarenko maksym-nazarenko deleted the default-values-in-documentation branch September 20, 2023 06:11
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