Skip to content

Commit

Permalink
chore: Fix some unwanted change in project (#732)
Browse files Browse the repository at this point in the history
* Fix some unwanted change in project

* remove default
  • Loading branch information
HuyPhanNguyen authored Aug 13, 2024
1 parent 4d50ff0 commit f11f6f9
Showing 1 changed file with 31 additions and 19 deletions.
50 changes: 31 additions & 19 deletions octopusdeploy_framework/schemas/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import (
"github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy_framework/util"
datasourceSchema "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
resourceSchema "github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/boolplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/listplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/objectplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
)

Expand All @@ -19,23 +24,23 @@ func GetProjectResourceSchema() resourceSchema.Schema {
"name": util.GetNameResourceSchema(true),
"description": util.GetDescriptionResourceSchema(ProjectResourceName),
"allow_deployments_to_no_targets": util.ResourceBool().Optional().Deprecated("This value is only valid for an associated connectivity policy and should not be specified here.").Build(),
"auto_create_release": util.ResourceBool().Optional().Computed().Build(),
"auto_create_release": util.ResourceBool().Optional().Computed().PlanModifiers(boolplanmodifier.UseStateForUnknown()).Build(),
"cloned_from_project_id": util.ResourceString().Optional().Description("The ID of the project this project was cloned from.").Build(),
"default_guided_failure_mode": util.ResourceString().Optional().Computed().Build(),
"default_to_skip_if_already_installed": util.ResourceBool().Optional().Computed().Build(),
"deployment_changes_template": util.ResourceString().Optional().Computed().Build(),
"discrete_channel_release": util.ResourceBool().Optional().Computed().Description("Treats releases of different channels to the same environment as a separate deployment dimension").Build(),
"is_disabled": util.ResourceBool().Optional().Computed().Build(),
"is_discrete_channel_release": util.ResourceBool().Optional().Computed().Description("Treats releases of different channels to the same environment as a separate deployment dimension").Build(),
"is_version_controlled": util.ResourceBool().Optional().Computed().Build(),
"default_guided_failure_mode": util.ResourceString().Optional().Computed().PlanModifiers(stringplanmodifier.UseStateForUnknown()).Build(),
"default_to_skip_if_already_installed": util.ResourceBool().Optional().Computed().PlanModifiers(boolplanmodifier.UseStateForUnknown()).Build(),
"deployment_changes_template": util.ResourceString().Optional().Computed().PlanModifiers(stringplanmodifier.UseStateForUnknown()).Build(),
"discrete_channel_release": util.ResourceBool().Optional().Computed().PlanModifiers(boolplanmodifier.UseStateForUnknown()).Description("Treats releases of different channels to the same environment as a separate deployment dimension").Build(),
"is_disabled": util.ResourceBool().Optional().Computed().PlanModifiers(boolplanmodifier.UseStateForUnknown()).Build(),
"is_discrete_channel_release": util.ResourceBool().Optional().Computed().PlanModifiers(boolplanmodifier.UseStateForUnknown()).Description("Treats releases of different channels to the same environment as a separate deployment dimension").Build(),
"is_version_controlled": util.ResourceBool().Optional().Computed().PlanModifiers(boolplanmodifier.UseStateForUnknown()).Build(),
"lifecycle_id": util.ResourceString().Required().Description("The lifecycle ID associated with this project.").Build(),
"project_group_id": util.ResourceString().Required().Description("The project group ID associated with this project.").Build(),
"tenanted_deployment_participation": util.ResourceString().Optional().Computed().Description("The tenanted deployment mode of the resource. Valid account types are `Untenanted`, `TenantedOrUntenanted`, or `Tenanted`.").Build(),
"included_library_variable_sets": util.ResourceList(types.StringType).Optional().Computed().Description("The list of included library variable set IDs.").Build(),
"release_notes_template": util.ResourceString().Optional().Computed().Build(),
"slug": util.ResourceString().Optional().Computed().Description("A human-readable, unique identifier, used to identify a project.").Build(),
"deployment_process_id": util.ResourceString().Computed().Build(),
"variable_set_id": util.ResourceString().Computed().Build(),
"tenanted_deployment_participation": util.ResourceString().Optional().Computed().PlanModifiers(stringplanmodifier.UseStateForUnknown()).Description("The tenanted deployment mode of the resource. Valid account types are `Untenanted`, `TenantedOrUntenanted`, or `Tenanted`.").Build(),
"included_library_variable_sets": util.ResourceList(types.StringType).Optional().Computed().PlanModifiers(listplanmodifier.UseStateForUnknown()).Description("The list of included library variable set IDs.").Build(),
"release_notes_template": util.ResourceString().Optional().Computed().PlanModifiers(stringplanmodifier.UseStateForUnknown()).Build(),
"slug": util.ResourceString().Optional().Computed().PlanModifiers(stringplanmodifier.UseStateForUnknown()).Description("A human-readable, unique identifier, used to identify a project.").Build(),
"deployment_process_id": util.ResourceString().Computed().PlanModifiers(stringplanmodifier.UseStateForUnknown()).Build(),
"variable_set_id": util.ResourceString().Computed().PlanModifiers(stringplanmodifier.UseStateForUnknown()).Build(),
},
Blocks: map[string]resourceSchema.Block{
// This is correct object that return from api for project object not a list string.
Expand All @@ -50,13 +55,19 @@ func GetProjectResourceSchema() resourceSchema.Schema {
},
"connectivity_policy": resourceSchema.ListNestedBlock{
NestedObject: resourceSchema.NestedBlockObject{
PlanModifiers: []planmodifier.Object{
objectplanmodifier.UseStateForUnknown(),
},
Attributes: map[string]resourceSchema.Attribute{
"allow_deployments_to_no_targets": util.ResourceBool().Optional().Computed().Build(),
"exclude_unhealthy_targets": util.ResourceBool().Optional().Computed().Build(),
"skip_machine_behavior": util.ResourceString().Optional().Build(),
"target_roles": util.ResourceList(types.StringType).Optional().Computed().Build(),
"allow_deployments_to_no_targets": util.ResourceBool().Optional().Computed().Default(false).PlanModifiers(boolplanmodifier.UseStateForUnknown()).Build(),
"exclude_unhealthy_targets": util.ResourceBool().Optional().Computed().Default(false).PlanModifiers(boolplanmodifier.UseStateForUnknown()).Build(),
"skip_machine_behavior": util.ResourceString().Optional().Computed().Default("None").PlanModifiers(stringplanmodifier.UseStateForUnknown()).Build(),
"target_roles": util.ResourceList(types.StringType).Optional().Computed().PlanModifiers(listplanmodifier.UseStateForUnknown()).Build(),
},
},
PlanModifiers: []planmodifier.List{
listplanmodifier.UseStateForUnknown(),
},
},
"git_anonymous_persistence_settings": resourceSchema.ListNestedBlock{
NestedObject: resourceSchema.NestedBlockObject{
Expand Down Expand Up @@ -133,9 +144,10 @@ func GetProjectResourceSchema() resourceSchema.Schema {
},
"versioning_strategy": resourceSchema.ListNestedBlock{
NestedObject: resourceSchema.NestedBlockObject{

Attributes: map[string]resourceSchema.Attribute{
"donor_package_step_id": util.ResourceString().Optional().Build(),
"template": util.ResourceString().Optional().Build(),
"template": util.ResourceString().Optional().Computed().Build(),
},
Blocks: map[string]resourceSchema.Block{
"donor_package": resourceSchema.ListNestedBlock{
Expand Down

0 comments on commit f11f6f9

Please sign in to comment.