From 2935145ee6e877d59eacda98ab8eab24aa5abfa9 Mon Sep 17 00:00:00 2001 From: Jarryd Tilbrook Date: Fri, 6 Oct 2023 10:44:50 +0800 Subject: [PATCH 1/5] Allow filter_condition on bitbucket --- buildkite/resource_pipeline.go | 4 ++-- docs/resources/pipeline.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/buildkite/resource_pipeline.go b/buildkite/resource_pipeline.go index 303aaaf0..75a1dcec 100644 --- a/buildkite/resource_pipeline.go +++ b/buildkite/resource_pipeline.go @@ -622,9 +622,9 @@ func (*pipelineResource) Schema(ctx context.Context, req resource.SchemaRequest, Computed: true, Optional: true, MarkdownDescription: "Whether to filter builds to only run when the condition in `filter_condition` is true." + - "Only valid for GitHub repositories when `trigger_mode = \"code\"`.", + "Only valid for Bitbucket, or GitHub repositories when `trigger_mode = \"code\"`.", PlanModifiers: []planmodifier.Bool{ - custom_modifier.WhenRepositoryProviderIs(custom_modifier.RepositoryProviderGitHub), + custom_modifier.WhenRepositoryProviderIs(custom_modifier.RepositoryProviderGitHub, custom_modifier.RepositoryProviderBitbucket), }, Validators: []validator.Bool{ boolvalidation.WhenString(path.MatchRoot("provider_settings").AtName("trigger_mode"), "code"), diff --git a/docs/resources/pipeline.md b/docs/resources/pipeline.md index 33655f94..f0e62884 100644 --- a/docs/resources/pipeline.md +++ b/docs/resources/pipeline.md @@ -81,7 +81,7 @@ Optional: - `build_tags` (Boolean) Whether to create builds when tags are pushed. Only valid for GitHub and Bitbucket repositories. - `cancel_deleted_branch_builds` (Boolean) Automatically cancel running builds for a branch if the branch is deleted. Only valid for GitHub repositories when `trigger_mode = "code"`. - `filter_condition` (String) The condition to evaluate when deciding if a build should run.More details available in [the documentation](https://buildkite.com/docs/pipelines/conditionals#conditionals-in-pipelines).Only valid if `filter_enabled = true`. -- `filter_enabled` (Boolean) Whether to filter builds to only run when the condition in `filter_condition` is true.Only valid for GitHub repositories when `trigger_mode = "code"`. +- `filter_enabled` (Boolean) Whether to filter builds to only run when the condition in `filter_condition` is true.Only valid for Bitbucket, or GitHub repositories when `trigger_mode = "code"`. - `prefix_pull_request_fork_branch_names` (Boolean) Prefix branch names for third-party fork builds to ensure they don't trigger branch conditions.For example, the master branch from some-user will become some-user:master.Only valid when `build_pull_request_forks = true`. - `publish_blocked_as_pending` (Boolean) The status to use for blocked builds. Pending can be used with [required status checks](https://help.github.com/en/articles/enabling-required-status-checks)to prevent merging pull requests with blocked builds. Only valid for GitHub repositories when `publish_commit_statue = true`. - `publish_commit_status` (Boolean) Whether to update the status of commits in Bitbucket or GitHub.Only valid for Bitbucket, or GitHub repositories when `trigger_mode = "code"`. From a2394fde5cc150e37c135bddbf03322a6dadeae6 Mon Sep 17 00:00:00 2001 From: Jarryd Tilbrook Date: Fri, 6 Oct 2023 10:51:33 +0800 Subject: [PATCH 2/5] Update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63287615..d8b942b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [v1.0.3](https://github.com/buildkite/terraform-provider-buildkite/compare/v1.0.2...v1.0.3) + +- Allow filter_condition on bitbucket [[PR #414](https://github.com/buildkite/terraform-provider-buildkite/pull/414)] @jradtilbrook + ## [v1.0.2](https://github.com/buildkite/terraform-provider-buildkite/compare/v1.0.1...v1.0.2) - SUP-1460 Fix provider_settings validation [[PR #412](https://github.com/buildkite/terraform-provider-buildkite/pull/412)] @jradtilbrook From 29f074897c0fb0d6fc3aee6306a5e967c6c971d0 Mon Sep 17 00:00:00 2001 From: Jarryd Tilbrook Date: Mon, 9 Oct 2023 14:52:18 +0800 Subject: [PATCH 3/5] Remove validation --- buildkite/resource_pipeline.go | 172 ++++------------- internal/boolvalidation/when.go | 111 ----------- internal/boolvalidation/when_test.go | 124 ------------ internal/planmodifier/repository_provider.go | 133 ------------- .../planmodifier/repository_provider_test.go | 177 ------------------ internal/stringvalidation/when.go | 111 ----------- internal/stringvalidation/when_test.go | 124 ------------ 7 files changed, 33 insertions(+), 919 deletions(-) delete mode 100644 internal/boolvalidation/when.go delete mode 100644 internal/boolvalidation/when_test.go delete mode 100644 internal/planmodifier/repository_provider.go delete mode 100644 internal/planmodifier/repository_provider_test.go delete mode 100644 internal/stringvalidation/when.go delete mode 100644 internal/stringvalidation/when_test.go diff --git a/buildkite/resource_pipeline.go b/buildkite/resource_pipeline.go index 75a1dcec..a02f7311 100644 --- a/buildkite/resource_pipeline.go +++ b/buildkite/resource_pipeline.go @@ -8,11 +8,8 @@ import ( "unsafe" "github.com/MakeNowJust/heredoc" - "github.com/buildkite/terraform-provider-buildkite/internal/boolvalidation" custom_modifier "github.com/buildkite/terraform-provider-buildkite/internal/planmodifier" - "github.com/buildkite/terraform-provider-buildkite/internal/stringvalidation" "github.com/hashicorp/terraform-plugin-framework-validators/listvalidator" - "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -489,203 +486,100 @@ func (*pipelineResource) Schema(ctx context.Context, req resource.SchemaRequest, "`none` will not create any builds based on GitHub activity.", "`trigger_mode`", ), - PlanModifiers: []planmodifier.String{ - custom_modifier.WhenRepositoryProviderIs(custom_modifier.RepositoryProviderGitHub), - }, - Validators: []validator.String{ - stringvalidator.OneOf("code", "deployment", "fork", "none"), - }, }, "build_pull_requests": schema.BoolAttribute{ - Optional: true, - Computed: true, - MarkdownDescription: "Whether to create builds for commits that are part part of a pull request." + - "Only valid for Bitbucket or GitHub using a `trigger_mode = \"code\"`", - PlanModifiers: []planmodifier.Bool{ - custom_modifier.WhenRepositoryProviderIs(custom_modifier.RepositoryProviderBitbucket, custom_modifier.RepositoryProviderGitHub), - }, - Validators: []validator.Bool{ - boolvalidation.WhenString(path.MatchRoot("provider_settings").AtName("trigger_mode"), "code"), - }, + Optional: true, + Computed: true, + MarkdownDescription: "Whether to create builds for commits that are part of a pull request.", }, "pull_request_branch_filter_enabled": schema.BoolAttribute{ Computed: true, Optional: true, - MarkdownDescription: "Filter pull request builds. Only valid if `build_pull_requests = true`.", - Validators: []validator.Bool{ - boolvalidation.WhenBool(path.MatchRoot("provider_settings").AtName("build_pull_requests"), true), - }, + MarkdownDescription: "Filter pull request builds.", }, "pull_request_branch_filter_configuration": schema.StringAttribute{ Computed: true, Optional: true, - MarkdownDescription: "Filter pull requests builds by the branch filter. Only valid if `pull_request_branch_filter_enabled = true`.", - Validators: []validator.String{ - stringvalidation.WhenBool(path.MatchRoot("provider_settings").AtName("pull_request_branch_filter_enabled"), true), - }, + MarkdownDescription: "Filter pull requests builds by the branch filter.", }, "skip_builds_for_existing_commits": schema.BoolAttribute{ - Optional: true, - Computed: true, - MarkdownDescription: "Whether to skip creating a new build if an existing build for the commit and branch already exists." + - "Only valid for GitHub repositories.", - PlanModifiers: []planmodifier.Bool{ - custom_modifier.WhenRepositoryProviderIs(custom_modifier.RepositoryProviderGitHub), - }, + Optional: true, + Computed: true, + MarkdownDescription: "Whether to skip creating a new build if an existing build for the commit and branch already exists.", }, "skip_pull_request_builds_for_existing_commits": schema.BoolAttribute{ - Optional: true, - Computed: true, - MarkdownDescription: "Whether to skip creating a new build for a pull request if an existing build for the commit and branch already exists." + - "Only valid if `build_pull_requests = true`.", - Validators: []validator.Bool{ - boolvalidation.WhenBool(path.MatchRoot("provider_settings").AtName("build_pull_requests"), true), - }, + Optional: true, + Computed: true, + MarkdownDescription: "Whether to skip creating a new build for a pull request if an existing build for the commit and branch already exists.", }, "build_pull_request_ready_for_review": schema.BoolAttribute{ - Computed: true, - Optional: true, - MarkdownDescription: "Whether to create a build when a pull request changes to \"Ready for review\"." + - "Only valid for GitHub repositories that have `trigger_mode = \"code\"` and `build_pull_requests = true`.", - PlanModifiers: []planmodifier.Bool{ - custom_modifier.WhenRepositoryProviderIs(custom_modifier.RepositoryProviderGitHub), - }, - Validators: []validator.Bool{ - boolvalidation.WhenString(path.MatchRoot("provider_settings").AtName("trigger_mode"), "code"), - boolvalidation.WhenBool(path.MatchRoot("provider_settings").AtName("build_pull_requests"), true), - }, + Computed: true, + Optional: true, + MarkdownDescription: "Whether to create a build when a pull request changes to \"Ready for review\".", }, "build_pull_request_labels_changed": schema.BoolAttribute{ - Computed: true, - Optional: true, - MarkdownDescription: "Whether to create builds for pull requests when labels are added or removed." + - "Only valid for GitHub repositories that have `trigger_mode = \"code\"` and `build_pull_requests = true`.", - PlanModifiers: []planmodifier.Bool{ - custom_modifier.WhenRepositoryProviderIs(custom_modifier.RepositoryProviderGitHub), - }, - Validators: []validator.Bool{ - boolvalidation.WhenString(path.MatchRoot("provider_settings").AtName("trigger_mode"), "code"), - boolvalidation.WhenBool(path.MatchRoot("provider_settings").AtName("build_pull_requests"), true), - }, + Computed: true, + Optional: true, + MarkdownDescription: "Whether to create builds for pull requests when labels are added or removed.", }, "build_pull_request_forks": schema.BoolAttribute{ - Computed: true, - Optional: true, - MarkdownDescription: "Whether to create builds for pull requests from third-party forks." + - "Only valid for GitHub repositories that have `trigger_mode = \"code\"` and `build_pull_requests = true`.", - PlanModifiers: []planmodifier.Bool{ - custom_modifier.WhenRepositoryProviderIs(custom_modifier.RepositoryProviderGitHub), - }, - Validators: []validator.Bool{ - boolvalidation.WhenString(path.MatchRoot("provider_settings").AtName("trigger_mode"), "code"), - boolvalidation.WhenBool(path.MatchRoot("provider_settings").AtName("build_pull_requests"), true), - }, + Computed: true, + Optional: true, + MarkdownDescription: "Whether to create builds for pull requests from third-party forks.", }, "prefix_pull_request_fork_branch_names": schema.BoolAttribute{ Computed: true, Optional: true, MarkdownDescription: "Prefix branch names for third-party fork builds to ensure they don't trigger branch conditions." + - "For example, the master branch from some-user will become some-user:master." + - "Only valid when `build_pull_request_forks = true`.", - Validators: []validator.Bool{ - boolvalidation.WhenBool(path.MatchRoot("provider_settings").AtName("build_pull_request_forks"), true), - }, + " For example, the main branch from some-user will become some-user:main.", }, "build_branches": schema.BoolAttribute{ Optional: true, Computed: true, - MarkdownDescription: "Whether to create builds when branches are pushed. Only valid for GitHub and Bitbucket repositories.", - PlanModifiers: []planmodifier.Bool{ - custom_modifier.WhenRepositoryProviderIs(custom_modifier.RepositoryProviderGitHub, custom_modifier.RepositoryProviderBitbucket), - }, + MarkdownDescription: "Whether to create builds when branches are pushed.", }, "build_tags": schema.BoolAttribute{ Computed: true, Optional: true, - MarkdownDescription: "Whether to create builds when tags are pushed. Only valid for GitHub and Bitbucket repositories.", - PlanModifiers: []planmodifier.Bool{ - custom_modifier.WhenRepositoryProviderIs(custom_modifier.RepositoryProviderGitHub, custom_modifier.RepositoryProviderBitbucket), - }, + MarkdownDescription: "Whether to create builds when tags are pushed.", }, "cancel_deleted_branch_builds": schema.BoolAttribute{ Computed: true, Optional: true, - MarkdownDescription: "Automatically cancel running builds for a branch if the branch is deleted. Only valid for GitHub repositories when `trigger_mode = \"code\"`.", - PlanModifiers: []planmodifier.Bool{ - custom_modifier.WhenRepositoryProviderIs(custom_modifier.RepositoryProviderGitHub), - }, - Validators: []validator.Bool{ - boolvalidation.WhenString(path.MatchRoot("provider_settings").AtName("trigger_mode"), "code"), - }, + MarkdownDescription: "Automatically cancel running builds for a branch if the branch is deleted.", }, "filter_enabled": schema.BoolAttribute{ - Computed: true, - Optional: true, - MarkdownDescription: "Whether to filter builds to only run when the condition in `filter_condition` is true." + - "Only valid for Bitbucket, or GitHub repositories when `trigger_mode = \"code\"`.", - PlanModifiers: []planmodifier.Bool{ - custom_modifier.WhenRepositoryProviderIs(custom_modifier.RepositoryProviderGitHub, custom_modifier.RepositoryProviderBitbucket), - }, - Validators: []validator.Bool{ - boolvalidation.WhenString(path.MatchRoot("provider_settings").AtName("trigger_mode"), "code"), - }, + Computed: true, + Optional: true, + MarkdownDescription: "Whether to filter builds to only run when the condition in `filter_condition` is true.", }, "filter_condition": schema.StringAttribute{ Computed: true, Optional: true, MarkdownDescription: "The condition to evaluate when deciding if a build should run." + - "More details available in [the documentation](https://buildkite.com/docs/pipelines/conditionals#conditionals-in-pipelines)." + - "Only valid if `filter_enabled = true`.", - Validators: []validator.String{ - stringvalidation.WhenBool(path.MatchRoot("provider_settings").AtName("filter_enabled"), true), - }, + " More details available in [the documentation](https://buildkite.com/docs/pipelines/conditionals#conditionals-in-pipelines).", }, "publish_commit_status": schema.BoolAttribute{ - Optional: true, - Computed: true, - MarkdownDescription: "Whether to update the status of commits in Bitbucket or GitHub." + - "Only valid for Bitbucket, or GitHub repositories when `trigger_mode = \"code\"`.", - PlanModifiers: []planmodifier.Bool{ - custom_modifier.WhenRepositoryProviderIs(custom_modifier.RepositoryProviderBitbucket, custom_modifier.RepositoryProviderGitHub), - }, - Validators: []validator.Bool{ - boolvalidation.WhenString(path.MatchRoot("provider_settings").AtName("trigger_mode"), "code"), - }, + Optional: true, + Computed: true, + MarkdownDescription: "Whether to update the status of commits in Bitbucket or GitHub.", }, "publish_blocked_as_pending": schema.BoolAttribute{ Computed: true, Optional: true, MarkdownDescription: "The status to use for blocked builds. Pending can be used with [required status checks](https://help.github.com/en/articles/enabling-required-status-checks)" + - "to prevent merging pull requests with blocked builds. Only valid for GitHub repositories when `publish_commit_statue = true`.", - PlanModifiers: []planmodifier.Bool{ - custom_modifier.WhenRepositoryProviderIs(custom_modifier.RepositoryProviderGitHub), - }, - Validators: []validator.Bool{ - boolvalidation.WhenBool(path.MatchRoot("provider_settings").AtName("publish_commit_status"), true), - }, + " to prevent merging pull requests with blocked builds.", }, "publish_commit_status_per_step": schema.BoolAttribute{ Computed: true, Optional: true, MarkdownDescription: "Whether to create a separate status for each job in a build, allowing you to see the status of each job directly in Bitbucket or GitHub.", - PlanModifiers: []planmodifier.Bool{ - custom_modifier.WhenRepositoryProviderIs(custom_modifier.RepositoryProviderGitHub, custom_modifier.RepositoryProviderBitbucket), - }, - Validators: []validator.Bool{ - boolvalidation.WhenBool(path.MatchRoot("provider_settings").AtName("publish_commit_status"), true), - }, }, "separate_pull_request_statuses": schema.BoolAttribute{ Computed: true, Optional: true, MarkdownDescription: "Whether to create a separate status for pull request builds, allowing you to require a passing pull request" + - "build in your [required status checks](https://help.github.com/en/articles/enabling-required-status-checks) in GitHub.", - PlanModifiers: []planmodifier.Bool{ - custom_modifier.WhenRepositoryProviderIs(custom_modifier.RepositoryProviderGitHub), - }, - Validators: []validator.Bool{ - boolvalidation.WhenBool(path.MatchRoot("provider_settings").AtName("publish_commit_status"), true), - }, + " build in your [required status checks](https://help.github.com/en/articles/enabling-required-status-checks) in GitHub.", }, }, }, diff --git a/internal/boolvalidation/when.go b/internal/boolvalidation/when.go deleted file mode 100644 index acb1e0ac..00000000 --- a/internal/boolvalidation/when.go +++ /dev/null @@ -1,111 +0,0 @@ -package boolvalidation - -import ( - "context" - "fmt" - - "github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag" - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/tfsdk" - "github.com/hashicorp/terraform-plugin-framework/types" -) - -type whenValidator struct { - expression path.Expression - value attr.Value -} - -type whenValidatorRequest struct { - Config tfsdk.Config - ConfigValue attr.Value -} - -type whenValidatorResponse struct { - Diagnostics diag.Diagnostics -} - -// Description implements validator.Bool. -func (when whenValidator) Description(ctx context.Context) string { - return when.MarkdownDescription(ctx) -} - -// MarkdownDescription implements validator.Bool. -func (when whenValidator) MarkdownDescription(context.Context) string { - return fmt.Sprintf("This attribute can only be set when the dependent attribute is set to: %s", when.value) -} - -func (when whenValidator) Validate(ctx context.Context, req whenValidatorRequest, resp *whenValidatorResponse) { - // if the value is null or unknown then nothing to do - if req.ConfigValue.IsNull() || req.ConfigValue.IsUnknown() { - return - } - - // get the value from config - matchedPaths, diags := req.Config.PathMatches(ctx, when.expression) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - - for _, matchedPath := range matchedPaths { - var matchedPathValue attr.Value - - diags := req.Config.GetAttribute(ctx, matchedPath, &matchedPathValue) - resp.Diagnostics.Append(diags...) - // Collect all errors - if diags.HasError() { - continue - } - - // If the matched path value is null or unknown, we cannot compare - // values, so continue to other matched paths. - if matchedPathValue.IsNull() || matchedPathValue.IsUnknown() { - continue - } - - var val attr.Value - diags = tfsdk.ValueAs(ctx, matchedPathValue, &val) - resp.Diagnostics.Append(diags...) - if diags.HasError() { - continue - } - - if !val.Equal(when.value) { - resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(matchedPath, fmt.Sprintf("%s", when.value), val.String())) - } - } -} - -func (when whenValidator) ValidateString(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse) { - validateReq := whenValidatorRequest{ - Config: req.Config, - ConfigValue: req.ConfigValue, - } - validateResp := &whenValidatorResponse{} - when.Validate(ctx, validateReq, validateResp) - - resp.Diagnostics.Append(validateResp.Diagnostics...) -} - -// ValidateBool adds a diagnostic error if the configured attribute is not set the the required value -func (when whenValidator) ValidateBool(ctx context.Context, req validator.BoolRequest, resp *validator.BoolResponse) { - validateReq := whenValidatorRequest{ - Config: req.Config, - ConfigValue: req.ConfigValue, - } - validateResp := &whenValidatorResponse{} - when.Validate(ctx, validateReq, validateResp) - - resp.Diagnostics.Append(validateResp.Diagnostics...) -} - -func WhenString(attr path.Expression, value string) validator.Bool { - return whenValidator{attr, types.StringValue(value)} -} - -func WhenBool(attr path.Expression, value bool) validator.Bool { - return whenValidator{attr, types.BoolValue(value)} -} diff --git a/internal/boolvalidation/when_test.go b/internal/boolvalidation/when_test.go deleted file mode 100644 index 78e7704c..00000000 --- a/internal/boolvalidation/when_test.go +++ /dev/null @@ -1,124 +0,0 @@ -package boolvalidation - -import ( - "context" - "testing" - - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-framework/provider/schema" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/tfsdk" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" - "github.com/hashicorp/terraform-plugin-go/tftypes" -) - -func TestBoolWhenValidation(t *testing.T) { - t.Parallel() - - testCases := map[string]struct { - request validator.BoolRequest - expectError bool - }{ - "matching value": { - request: validator.BoolRequest{ - Config: tfsdk.Config{ - Raw: tftypes.NewValue(tftypes.Object{ - AttributeTypes: map[string]tftypes.Type{ - "name": tftypes.String, - }, - }, map[string]tftypes.Value{ - "name": tftypes.NewValue(tftypes.String, "value"), - }), - Schema: schema.Schema{ - Attributes: map[string]schema.Attribute{ - "name": schema.StringAttribute{ - Required: true, - }, - }, - }, - }, - }, - }, - "not matching value": { - expectError: true, - request: validator.BoolRequest{ - ConfigValue: basetypes.NewBoolValue(true), - Config: tfsdk.Config{ - Raw: tftypes.NewValue(tftypes.Object{ - AttributeTypes: map[string]tftypes.Type{ - "name": tftypes.String, - }, - }, map[string]tftypes.Value{ - "name": tftypes.NewValue(tftypes.String, "not value"), - }), - Schema: schema.Schema{ - Attributes: map[string]schema.Attribute{ - "name": schema.StringAttribute{ - Required: true, - }, - }, - }, - }, - }, - }, - "unknown value": { - request: validator.BoolRequest{ - ConfigValue: basetypes.NewBoolUnknown(), - Config: tfsdk.Config{ - Raw: tftypes.NewValue(tftypes.Object{ - AttributeTypes: map[string]tftypes.Type{ - "name": tftypes.String, - }, - }, map[string]tftypes.Value{ - "name": tftypes.NewValue(tftypes.String, "not value"), - }), - Schema: schema.Schema{ - Attributes: map[string]schema.Attribute{ - "name": schema.StringAttribute{ - Required: true, - }, - }, - }, - }, - }, - }, - "null value": { - request: validator.BoolRequest{ - ConfigValue: basetypes.NewBoolPointerValue(nil), - Config: tfsdk.Config{ - Raw: tftypes.NewValue(tftypes.Object{ - AttributeTypes: map[string]tftypes.Type{ - "name": tftypes.String, - }, - }, map[string]tftypes.Value{ - "name": tftypes.NewValue(tftypes.String, "not value"), - }), - Schema: schema.Schema{ - Attributes: map[string]schema.Attribute{ - "name": schema.StringAttribute{ - Required: true, - }, - }, - }, - }, - }, - }, - } - - for name, testCase := range testCases { - name, testCase := name, testCase - t.Run(name, func(t *testing.T) { - t.Parallel() - resp := validator.BoolResponse{ - Diagnostics: diag.Diagnostics{}, - } - - WhenString(path.MatchRoot("name"), "value").ValidateBool(context.Background(), testCase.request, &resp) - - if testCase.expectError != resp.Diagnostics.HasError() { - t.Error("Expected error mismatch") - } - }) - } -} diff --git a/internal/planmodifier/repository_provider.go b/internal/planmodifier/repository_provider.go deleted file mode 100644 index 43bcd685..00000000 --- a/internal/planmodifier/repository_provider.go +++ /dev/null @@ -1,133 +0,0 @@ -package planmodifier - -import ( - "context" - "fmt" - - "github.com/cli/go-gh/pkg/repository" - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" - "github.com/hashicorp/terraform-plugin-framework/tfsdk" - "github.com/hashicorp/terraform-plugin-framework/types" -) - -type RepositoryProvider string - -const ( - RepositoryProviderGitHub RepositoryProvider = "GitHub" - RepositoryProviderGitLab RepositoryProvider = "GitLab" - RepositoryProviderBitbucket RepositoryProvider = "Bitbucket" - RepositoryProviderPrivate RepositoryProvider = "Private" -) - -type PlanModifier interface { - planmodifier.Bool - planmodifier.String -} - -type repositoryProviderPlanModifier struct { - values []RepositoryProvider -} - -// PlanModifyString implements PlanModifier. -func (mod repositoryProviderPlanModifier) PlanModifyString(ctx context.Context, req planmodifier.StringRequest, resp *planmodifier.StringResponse) { - var response repositoryProviderPlanModifierResponse - mod.PlanModify(ctx, repositoryProviderPlanModifierRequest{ - ConfigValue: req.ConfigValue, - Plan: req.Plan, - Path: req.Path, - }, &response) - - resp.Diagnostics.Append(response.Diagnostics...) -} - -func (mod repositoryProviderPlanModifier) PlanModify(ctx context.Context, req repositoryProviderPlanModifierRequest, resp *repositoryProviderPlanModifierResponse) { - // if the value is null or unknown then nothing to do - if req.ConfigValue.IsNull() || req.ConfigValue.IsUnknown() { - return - } - - // get the value from config - var repository types.String - resp.Diagnostics.Append(req.Plan.GetAttribute(ctx, path.Root("repository"), &repository)...) - repoProvider, err := findRepositoryProvider(repository.ValueString()) - - if err != nil { - resp.Diagnostics.AddWarning("Could not parse repository URL to validate configuration", fmt.Sprintf("repository value: %s", repository.ValueString())) - return - } - - if repoProvider == RepositoryProviderPrivate { - return - } - - var found bool - for _, match := range mod.values { - if repoProvider == match { - found = true - break - } - } - - if !found { - resp.Diagnostics.Append(diag.NewAttributeErrorDiagnostic(req.Path, "Invalid attribute value", fmt.Sprintf("`%s` cannot be set to %v when repository provider is: %s", req.Path.String(), req.ConfigValue, repoProvider))) - } -} - -type repositoryProviderPlanModifierRequest struct { - ConfigValue attr.Value - Plan tfsdk.Plan - Path path.Path -} - -type repositoryProviderPlanModifierResponse struct { - Diagnostics diag.Diagnostics -} - -func (when repositoryProviderPlanModifier) Description(ctx context.Context) string { - return when.MarkdownDescription(ctx) -} - -func (when repositoryProviderPlanModifier) MarkdownDescription(context.Context) string { - return fmt.Sprintf("This attribute can only be set when the repository provider is one of: %s", when.values) -} - -func (mod repositoryProviderPlanModifier) PlanModifyBool(ctx context.Context, req planmodifier.BoolRequest, resp *planmodifier.BoolResponse) { - var response repositoryProviderPlanModifierResponse - mod.PlanModify(ctx, repositoryProviderPlanModifierRequest{ - ConfigValue: req.ConfigValue, - Plan: req.Plan, - Path: req.Path, - }, &response) - - resp.Diagnostics.Append(response.Diagnostics...) -} - -func WhenRepositoryProviderIs(values ...RepositoryProvider) PlanModifier { - return repositoryProviderPlanModifier{values} -} - -func findRepositoryProvider(repo string) (RepositoryProvider, error) { - r, err := repository.Parse(repo) - if err != nil { - return "", err - } - - switch r.Host() { - case "github.com": - return RepositoryProviderGitHub, nil - case "bitbucket.org": - return RepositoryProviderBitbucket, nil - case "gitlab.com": - return RepositoryProviderGitLab, nil - default: - return discoverRemoteProvider(repo) - } -} - -// discoverRemoteProvider attempts to finds a matching remote provider URL from the API (eg for on-prem instances) -func discoverRemoteProvider(repo string) (RepositoryProvider, error) { - return RepositoryProviderPrivate, nil -} diff --git a/internal/planmodifier/repository_provider_test.go b/internal/planmodifier/repository_provider_test.go deleted file mode 100644 index 04dd7814..00000000 --- a/internal/planmodifier/repository_provider_test.go +++ /dev/null @@ -1,177 +0,0 @@ -package planmodifier - -import ( - "context" - "testing" - - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/provider/schema" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" - "github.com/hashicorp/terraform-plugin-framework/tfsdk" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-go/tftypes" -) - -func TestWhenRepositoryProviderIs(t *testing.T) { - t.Parallel() - - testCases := map[string]struct { - expected RepositoryProvider - request planmodifier.BoolRequest - expectError bool - }{ - "valid when needs github": { - expected: RepositoryProviderGitHub, - request: planmodifier.BoolRequest{ - ConfigValue: types.BoolValue(true), - Plan: tfsdk.Plan{ - Raw: tftypes.NewValue(tftypes.Object{ - AttributeTypes: map[string]tftypes.Type{ - "repository": tftypes.String, - }, - }, map[string]tftypes.Value{ - "repository": tftypes.NewValue(tftypes.String, "git@github.com:buildkite/terraform-provider-buildkite.git"), - }), - Schema: schema.Schema{ - Attributes: map[string]schema.Attribute{ - "repository": schema.StringAttribute{ - Required: true, - }, - }, - }, - }, - }, - }, - "invalid when doesnt match": { - expectError: true, - expected: RepositoryProviderBitbucket, - request: planmodifier.BoolRequest{ - ConfigValue: types.BoolValue(true), - Plan: tfsdk.Plan{ - Raw: tftypes.NewValue(tftypes.Object{ - AttributeTypes: map[string]tftypes.Type{ - "repository": tftypes.String, - }, - }, map[string]tftypes.Value{ - "repository": tftypes.NewValue(tftypes.String, "https://github.com/buildkite/terraform-provider-buildkite.git"), - }), - Schema: schema.Schema{ - Attributes: map[string]schema.Attribute{ - "repository": schema.StringAttribute{ - Required: true, - }, - }, - }, - }, - }, - }, - "interpolation": { - expected: RepositoryProviderBitbucket, - request: planmodifier.BoolRequest{ - ConfigValue: types.BoolValue(true), - Plan: tfsdk.Plan{ - Raw: tftypes.NewValue(tftypes.Object{ - AttributeTypes: map[string]tftypes.Type{ - "repository": tftypes.String, - }, - }, map[string]tftypes.Value{ - "repository": tftypes.NewValue(tftypes.String, "git@github.com:${var.repository}.git"), - }), - Schema: schema.Schema{ - Attributes: map[string]schema.Attribute{ - "repository": schema.StringAttribute{ - Required: true, - }, - }, - }, - }, - }, - }, - "does nothing if not configured": {}, - } - for name, testCase := range testCases { - name, testCase := name, testCase - t.Run(name, func(t *testing.T) { - t.Parallel() - resp := planmodifier.BoolResponse{ - Diagnostics: diag.Diagnostics{}, - } - - WhenRepositoryProviderIs(testCase.expected).PlanModifyBool(context.Background(), testCase.request, &resp) - - if testCase.expectError != resp.Diagnostics.HasError() { - t.Error(resp.Diagnostics[len(resp.Diagnostics)-1].Detail()) - } - }) - } -} - -func TestFindRepositoryProvider(t *testing.T) { - t.Parallel() - - t.Run("resolve github", func(t *testing.T) { - t.Parallel() - testcases := map[string]string{ - "git url": "git@github.com:buildkite/terraform-provider-buildkite.git", - "https url": "https://github.com/buildkite/terraform-provider-buildkite.git", - "https url without extension": "https://github.com/user/bitbucket-git-repo", - "https url with user": "https://user@github.com/buildkite/terraform-provider-buildkite.git", - "ssh url": "git://github.com/buildkite/terraform-provider-buildkite.git", - } - - for name, input := range testcases { - t.Run(name, func(t *testing.T) { - input := input - t.Parallel() - - provider, _ := findRepositoryProvider(input) - - if provider != RepositoryProviderGitHub { - t.Errorf("provider does not match %s != %s", provider, RepositoryProviderGitHub) - } - }) - } - }) - - t.Run("resolve gitlab", func(t *testing.T) { - t.Parallel() - testcases := map[string]string{ - "git url": "git@gitlab.com:foo/bar.git", - "https url": "https://user@gitlab.com/user/gitlab-git-repo.git", - } - - for name, input := range testcases { - t.Run(name, func(t *testing.T) { - input := input - t.Parallel() - - provider, _ := findRepositoryProvider(input) - - if provider != RepositoryProviderGitLab { - t.Errorf("provider does not match %s != %s", provider, RepositoryProviderGitHub) - } - }) - } - }) - - t.Run("resolve bitbucket urls", func(t *testing.T) { - t.Parallel() - testcases := map[string]string{ - "git url": "git@bitbucket.org:foo/bar.git", - "https url": "https://user@bitbucket.org/user/bitbucket-git-repo.git", - } - - for name, input := range testcases { - t.Run(name, func(t *testing.T) { - input := input - t.Parallel() - - provider, _ := findRepositoryProvider(input) - - if provider != RepositoryProviderBitbucket { - t.Errorf("provider does not match %s != %s", provider, RepositoryProviderBitbucket) - } - }) - } - }) -} diff --git a/internal/stringvalidation/when.go b/internal/stringvalidation/when.go deleted file mode 100644 index 432cf03b..00000000 --- a/internal/stringvalidation/when.go +++ /dev/null @@ -1,111 +0,0 @@ -package stringvalidation - -import ( - "context" - "fmt" - - "github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag" - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/tfsdk" - "github.com/hashicorp/terraform-plugin-framework/types" -) - -type whenValidator struct { - expression path.Expression - value attr.Value -} - -type whenValidatorRequest struct { - Config tfsdk.Config - ConfigValue attr.Value -} - -type whenValidatorResponse struct { - Diagnostics diag.Diagnostics -} - -// Description implements validator.Bool. -func (when whenValidator) Description(ctx context.Context) string { - return when.MarkdownDescription(ctx) -} - -// MarkdownDescription implements validator.Bool. -func (when whenValidator) MarkdownDescription(context.Context) string { - return fmt.Sprintf("This attribute can only be set when the dependent attribute is set to: %s", when.value) -} - -func (when whenValidator) Validate(ctx context.Context, req whenValidatorRequest, resp *whenValidatorResponse) { - // if the value is null or unknown then nothing to do - if req.ConfigValue.IsNull() || req.ConfigValue.IsUnknown() { - return - } - - // get the value from config - matchedPaths, diags := req.Config.PathMatches(ctx, when.expression) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - - for _, matchedPath := range matchedPaths { - var matchedPathValue attr.Value - - diags := req.Config.GetAttribute(ctx, matchedPath, &matchedPathValue) - resp.Diagnostics.Append(diags...) - // Collect all errors - if diags.HasError() { - continue - } - - // If the matched path value is null or unknown, we cannot compare - // values, so continue to other matched paths. - if matchedPathValue.IsNull() || matchedPathValue.IsUnknown() { - continue - } - - var val attr.Value - diags = tfsdk.ValueAs(ctx, matchedPathValue, &val) - resp.Diagnostics.Append(diags...) - if diags.HasError() { - continue - } - - if !val.Equal(when.value) { - resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(matchedPath, fmt.Sprintf("%s", when.value), val.String())) - } - } -} - -func (when whenValidator) ValidateString(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse) { - validateReq := whenValidatorRequest{ - Config: req.Config, - ConfigValue: req.ConfigValue, - } - validateResp := &whenValidatorResponse{} - when.Validate(ctx, validateReq, validateResp) - - resp.Diagnostics.Append(validateResp.Diagnostics...) -} - -// ValidateBool adds a diagnostic error if the configured attribute is not set the the required value -func (when whenValidator) ValidateBool(ctx context.Context, req validator.BoolRequest, resp *validator.BoolResponse) { - validateReq := whenValidatorRequest{ - Config: req.Config, - ConfigValue: req.ConfigValue, - } - validateResp := &whenValidatorResponse{} - when.Validate(ctx, validateReq, validateResp) - - resp.Diagnostics.Append(validateResp.Diagnostics...) -} - -func WhenString(attr path.Expression, value string) validator.String { - return whenValidator{attr, types.StringValue(value)} -} - -func WhenBool(attr path.Expression, value bool) validator.String { - return whenValidator{attr, types.BoolValue(value)} -} diff --git a/internal/stringvalidation/when_test.go b/internal/stringvalidation/when_test.go deleted file mode 100644 index 4f0e8008..00000000 --- a/internal/stringvalidation/when_test.go +++ /dev/null @@ -1,124 +0,0 @@ -package stringvalidation - -import ( - "context" - "testing" - - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/path" - "github.com/hashicorp/terraform-plugin-framework/provider/schema" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/tfsdk" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" - "github.com/hashicorp/terraform-plugin-go/tftypes" -) - -func TestWhenStringAttrIsValidator(t *testing.T) { - t.Parallel() - - testCases := map[string]struct { - request validator.StringRequest - expectError bool - }{ - "matching value": { - request: validator.StringRequest{ - Config: tfsdk.Config{ - Raw: tftypes.NewValue(tftypes.Object{ - AttributeTypes: map[string]tftypes.Type{ - "name": tftypes.String, - }, - }, map[string]tftypes.Value{ - "name": tftypes.NewValue(tftypes.String, "value"), - }), - Schema: schema.Schema{ - Attributes: map[string]schema.Attribute{ - "name": schema.StringAttribute{ - Required: true, - }, - }, - }, - }, - }, - }, - "not matching value": { - expectError: true, - request: validator.StringRequest{ - ConfigValue: basetypes.NewStringValue("any"), - Config: tfsdk.Config{ - Raw: tftypes.NewValue(tftypes.Object{ - AttributeTypes: map[string]tftypes.Type{ - "name": tftypes.String, - }, - }, map[string]tftypes.Value{ - "name": tftypes.NewValue(tftypes.String, "not value"), - }), - Schema: schema.Schema{ - Attributes: map[string]schema.Attribute{ - "name": schema.StringAttribute{ - Required: true, - }, - }, - }, - }, - }, - }, - "unknown value": { - request: validator.StringRequest{ - ConfigValue: basetypes.NewStringUnknown(), - Config: tfsdk.Config{ - Raw: tftypes.NewValue(tftypes.Object{ - AttributeTypes: map[string]tftypes.Type{ - "name": tftypes.String, - }, - }, map[string]tftypes.Value{ - "name": tftypes.NewValue(tftypes.String, "not value"), - }), - Schema: schema.Schema{ - Attributes: map[string]schema.Attribute{ - "name": schema.StringAttribute{ - Required: true, - }, - }, - }, - }, - }, - }, - "null value": { - request: validator.StringRequest{ - ConfigValue: basetypes.NewStringPointerValue(nil), - Config: tfsdk.Config{ - Raw: tftypes.NewValue(tftypes.Object{ - AttributeTypes: map[string]tftypes.Type{ - "name": tftypes.String, - }, - }, map[string]tftypes.Value{ - "name": tftypes.NewValue(tftypes.String, "not value"), - }), - Schema: schema.Schema{ - Attributes: map[string]schema.Attribute{ - "name": schema.StringAttribute{ - Required: true, - }, - }, - }, - }, - }, - }, - } - - for name, testCase := range testCases { - name, testCase := name, testCase - t.Run(name, func(t *testing.T) { - t.Parallel() - resp := validator.StringResponse{ - Diagnostics: diag.Diagnostics{}, - } - - WhenString(path.MatchRoot("name"), "value").ValidateString(context.Background(), testCase.request, &resp) - - if testCase.expectError != resp.Diagnostics.HasError() { - t.Error("Expected error mismatch") - } - }) - } -} From cf3e849e4d8b20bfacc43f81798bc8c9828237b3 Mon Sep 17 00:00:00 2001 From: Jarryd Tilbrook Date: Mon, 9 Oct 2023 14:52:52 +0800 Subject: [PATCH 4/5] Update docs --- docs/resources/pipeline.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/resources/pipeline.md b/docs/resources/pipeline.md index f0e62884..005feab8 100644 --- a/docs/resources/pipeline.md +++ b/docs/resources/pipeline.md @@ -73,24 +73,24 @@ resource "buildkite_pipeline" "pipeline" { Optional: -- `build_branches` (Boolean) Whether to create builds when branches are pushed. Only valid for GitHub and Bitbucket repositories. -- `build_pull_request_forks` (Boolean) Whether to create builds for pull requests from third-party forks.Only valid for GitHub repositories that have `trigger_mode = "code"` and `build_pull_requests = true`. -- `build_pull_request_labels_changed` (Boolean) Whether to create builds for pull requests when labels are added or removed.Only valid for GitHub repositories that have `trigger_mode = "code"` and `build_pull_requests = true`. -- `build_pull_request_ready_for_review` (Boolean) Whether to create a build when a pull request changes to "Ready for review".Only valid for GitHub repositories that have `trigger_mode = "code"` and `build_pull_requests = true`. -- `build_pull_requests` (Boolean) Whether to create builds for commits that are part part of a pull request.Only valid for Bitbucket or GitHub using a `trigger_mode = "code"` -- `build_tags` (Boolean) Whether to create builds when tags are pushed. Only valid for GitHub and Bitbucket repositories. -- `cancel_deleted_branch_builds` (Boolean) Automatically cancel running builds for a branch if the branch is deleted. Only valid for GitHub repositories when `trigger_mode = "code"`. -- `filter_condition` (String) The condition to evaluate when deciding if a build should run.More details available in [the documentation](https://buildkite.com/docs/pipelines/conditionals#conditionals-in-pipelines).Only valid if `filter_enabled = true`. -- `filter_enabled` (Boolean) Whether to filter builds to only run when the condition in `filter_condition` is true.Only valid for Bitbucket, or GitHub repositories when `trigger_mode = "code"`. -- `prefix_pull_request_fork_branch_names` (Boolean) Prefix branch names for third-party fork builds to ensure they don't trigger branch conditions.For example, the master branch from some-user will become some-user:master.Only valid when `build_pull_request_forks = true`. -- `publish_blocked_as_pending` (Boolean) The status to use for blocked builds. Pending can be used with [required status checks](https://help.github.com/en/articles/enabling-required-status-checks)to prevent merging pull requests with blocked builds. Only valid for GitHub repositories when `publish_commit_statue = true`. -- `publish_commit_status` (Boolean) Whether to update the status of commits in Bitbucket or GitHub.Only valid for Bitbucket, or GitHub repositories when `trigger_mode = "code"`. +- `build_branches` (Boolean) Whether to create builds when branches are pushed. +- `build_pull_request_forks` (Boolean) Whether to create builds for pull requests from third-party forks. +- `build_pull_request_labels_changed` (Boolean) Whether to create builds for pull requests when labels are added or removed. +- `build_pull_request_ready_for_review` (Boolean) Whether to create a build when a pull request changes to "Ready for review". +- `build_pull_requests` (Boolean) Whether to create builds for commits that are part of a pull request. +- `build_tags` (Boolean) Whether to create builds when tags are pushed. +- `cancel_deleted_branch_builds` (Boolean) Automatically cancel running builds for a branch if the branch is deleted. +- `filter_condition` (String) The condition to evaluate when deciding if a build should run. More details available in [the documentation](https://buildkite.com/docs/pipelines/conditionals#conditionals-in-pipelines). +- `filter_enabled` (Boolean) Whether to filter builds to only run when the condition in `filter_condition` is true. +- `prefix_pull_request_fork_branch_names` (Boolean) Prefix branch names for third-party fork builds to ensure they don't trigger branch conditions. For example, the main branch from some-user will become some-user:main. +- `publish_blocked_as_pending` (Boolean) The status to use for blocked builds. Pending can be used with [required status checks](https://help.github.com/en/articles/enabling-required-status-checks) to prevent merging pull requests with blocked builds. +- `publish_commit_status` (Boolean) Whether to update the status of commits in Bitbucket or GitHub. - `publish_commit_status_per_step` (Boolean) Whether to create a separate status for each job in a build, allowing you to see the status of each job directly in Bitbucket or GitHub. -- `pull_request_branch_filter_configuration` (String) Filter pull requests builds by the branch filter. Only valid if `pull_request_branch_filter_enabled = true`. -- `pull_request_branch_filter_enabled` (Boolean) Filter pull request builds. Only valid if `build_pull_requests = true`. -- `separate_pull_request_statuses` (Boolean) Whether to create a separate status for pull request builds, allowing you to require a passing pull requestbuild in your [required status checks](https://help.github.com/en/articles/enabling-required-status-checks) in GitHub. -- `skip_builds_for_existing_commits` (Boolean) Whether to skip creating a new build if an existing build for the commit and branch already exists.Only valid for GitHub repositories. -- `skip_pull_request_builds_for_existing_commits` (Boolean) Whether to skip creating a new build for a pull request if an existing build for the commit and branch already exists.Only valid if `build_pull_requests = true`. +- `pull_request_branch_filter_configuration` (String) Filter pull requests builds by the branch filter. +- `pull_request_branch_filter_enabled` (Boolean) Filter pull request builds. +- `separate_pull_request_statuses` (Boolean) Whether to create a separate status for pull request builds, allowing you to require a passing pull request build in your [required status checks](https://help.github.com/en/articles/enabling-required-status-checks) in GitHub. +- `skip_builds_for_existing_commits` (Boolean) Whether to skip creating a new build if an existing build for the commit and branch already exists. +- `skip_pull_request_builds_for_existing_commits` (Boolean) Whether to skip creating a new build for a pull request if an existing build for the commit and branch already exists. - `trigger_mode` (String) What type of event to trigger builds on. Must be one of: - `code` will create builds when code is pushed to GitHub. - `deployment` will create builds when a deployment is created in GitHub. From 19a50ab83d8f42d962b3ee29d8ccf905757cfd25 Mon Sep 17 00:00:00 2001 From: Jarryd Tilbrook Date: Mon, 9 Oct 2023 14:53:50 +0800 Subject: [PATCH 5/5] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8b942b6..201ee267 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## [v1.0.3](https://github.com/buildkite/terraform-provider-buildkite/compare/v1.0.2...v1.0.3) -- Allow filter_condition on bitbucket [[PR #414](https://github.com/buildkite/terraform-provider-buildkite/pull/414)] @jradtilbrook +- Remove validation on provider_settings [[PR #414](https://github.com/buildkite/terraform-provider-buildkite/pull/414)] @jradtilbrook ## [v1.0.2](https://github.com/buildkite/terraform-provider-buildkite/compare/v1.0.1...v1.0.2)