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

feat(bindplane_configuration): Support rollout options #102

Merged
merged 9 commits into from
Jul 22, 2024

Conversation

jsirianni
Copy link
Member

@jsirianni jsirianni commented Jul 17, 2024

Description of Changes

Implemented rollout options, for configuring the rollout behavior of a configuration. Default behavior is unchanged. When rollout options are not set, standard single stage rollouts are used.

The following snippet shows how a two stage progressive rollout can be configured.

resource "bindplane_configuration" "configuration-simple" {
...
  rollout_options {
    type = "progressive"
    parameters {
      name = "stages"
      value {
        labels = {
          env = "stage"
        }
        name = "stage"
      }
      value {
        labels = {
          env = "production"
        }
        name = "production"
      }
    }
  }
}

Changes

  • Added WithRolloutOptions option function for setting rollout parameters on a configuration resource
  • Updated Configuration to AnyResource conversion logic to consider the presence of configuration.spec.rollout

Testing

You can test using the following steps

  1. make test-local
  2. cd test/local
  3. export TF_CLI_CONFIG_FILE=./dev.tfrc
  4. Update main.tf` provider block to target your environment (user/pass, api key, endpoint, etc)
  5. terraform apply

Play around with main.tf's bindplane_configuration. The following should work

  1. Removal of the rollout_options
  2. standard rollout type, without parameters
  3. progressive rollout type, with parameters
  4. Changes to main.tf should cause apply to update bindplane
  5. Changes to the configuration (via the UI) should cause apply to update bindplane
  6. Try feeding jump data for name and value, bindplane api should return errors if something is not compatible
  7. Removing rollout options should result in the rollout reverting to "standard"

Please check that the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • CI passes

@jsirianni jsirianni marked this pull request as ready for review July 17, 2024 20:57
@jsirianni jsirianni requested a review from a team as a code owner July 17, 2024 20:57
@jsirianni jsirianni requested a review from tbm48813 July 18, 2024 13:30
@tbm48813
Copy link

Changing a name of a configuration doesnt move it's agents over.

Changing the platform of a configuration breaks it,, giving :
`Plan: 1 to add, 0 to change, 1 to destroy.

Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.

Enter a value: yes

bindplane_configuration.configuration: Creating...

│ Error: configuration with name 'my-config' already exists with id '01J364G11EWVBT567QXRFYR98B'

│ with bindplane_configuration.configuration,
│ on main.tf line 96, in resource "bindplane_configuration" "configuration":
│ 96: resource "bindplane_configuration" "configuration" {
│`

@jsirianni
Copy link
Member Author

nging the platform of a configuration breaks it,, giving :
`Plan: 1 to add, 0 to change, 1 to destroy.

  1. Changing the name: I would not expect agents to move over. I would expect the config to be deleted and then created under a new name.

  2. Yes, this is annoying. I would expect it to delete and then create. It appears to create before or during delete.

Both of these would fall outside of this PR, however. I think there is work to do there.

@jsirianni jsirianni merged commit 1608d7c into main Jul 22, 2024
20 checks passed
@jsirianni jsirianni deleted the joesirianni/bpop-360-terraform-progressive-rollouts branch July 22, 2024 14:44
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