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

Documentation enhancements for github_repository_deployment_branch_policy resource #1820

Conversation

calebplum
Copy link
Contributor

@calebplum calebplum commented Aug 3, 2023

Before the change?

  1. The documentation example is missing the required depends_on meta-argument. Without this, Terraform will often try to deploy the github_repository_deployment_branch_policy before the corresponding github_repository_environment which results in an ambiguous 404 error being returned from the API.

  2. A separate (but equally ambiguous) 404 is returned from the API when the github_repository_environment referenced by the github_repository_deployment_branch_policy resource has custom_branch_policies set to false. I believe the design pattern is to catch this error in the Terraform provider rather than rely on the API returning a descriptive error (which it doesn't do). This can catch one off-guard since the documentation says the custom_branch_policies must be set to true, but doesn't mention the somewhat unusual behaviour of the API returning a 404 (rather than Terraform complaining about the attribute) if this attribute is set incorrectly. This personally caused me a few hours of frustration, so it would be good to make others aware of this behaviour.

  3. The Terraform code in the example hadn't been run through terraform fmt.

After the change?

  1. The required depends_on attribute has been added to the documentation example to prevent the branch policy being created before the corresponding environment.

  2. The environment_name argument's description has been enhanced to describe the behaviour that occurs if deployment_branch_policy.custom_branch_policies is not set to true.

  3. The examples have been run through terraform fmt.

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

…esponding environment (which results in an error), add more detail about the error thrown if deployment_branch_policy.custom_branch_policies is not set to true, tf fmt example
@nickfloyd nickfloyd added the Type: Documentation Improvements or additions to documentation label Aug 4, 2023
Copy link
Contributor

@nickfloyd nickfloyd left a comment

Choose a reason for hiding this comment

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

Thanks for the contributions! ❤️

@nickfloyd nickfloyd merged commit 3549920 into integrations:main Aug 4, 2023
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants