hashicorp / terraform-cloud-operator

Kubernetes Operator allows managing HCP Terraform resources via Kubernetes Custom Resources.
https://developer.hashicorp.com/terraform/cloud-docs
Mozilla Public License 2.0
114 stars 27 forks source link

πŸš€ Add workspace trigger patterns to CRD #349

Open baptman21 opened 4 months ago

baptman21 commented 4 months ago

Description

Add the fields FileTriggersEnabled, TriggerPatterns and TriggerPrefixes to the Workspace CRD to allow the user to manage those fields.

The fields are already present in the go-tfe package but are currently not editable from the CRD.

Usage Example

References

Community Note

hashicorp-cla commented 4 months ago

CLA assistant check
All committers have signed the CLA.

arybolovlev commented 4 months ago

Hi @baptman21,

Thank you for your interest in contributing to this project. I am going to review this PR next week and come back to you with my comments.

Thank you.

arybolovlev commented 4 months ago

Hi @baptman21,

Thank you again for your interest in contributing to this project.

There are a few things that we need to work on here and I would be happy to assist you with them. Please let me know if you prefer to get a full list or we can go step by step.

To set the right expectation, we won't be able to include your changes in the nearest release since it will happen soon and we have already settled with the list of the changes that will be included in it.

We can start with Workspace CR validation. It aims to catch possible mistakes in the custom resources. Here are two that we can begin with:

Please, update unit tests for validations that you will add. You should be able to run them without accessing TFC. Here you can read how to do that.

Please, let me know if you need assistance.

Thanks!

baptman21 commented 4 months ago

Thanks for the update. I wasn't sure whether we needed to check here the validity of the settings or let the TF cloud API throw the error. I will make the changes as you requested.

baptman21 commented 4 months ago

Hello @arybolovlev,

I added the validation for those 3 cases:

The last one is not a specification of the API but rather a way to avoid mistakes like forgetting to enable the FileTriggerEnabled but defining the patterns, what do you think ?

Let me know if there are any other changes to make.

arybolovlev commented 4 months ago

Hi @baptman21,

I want to let you know that I remember about this PR and will come back once we cut a new release. Thank you for your patience and great job!