Skip to content

Commit

Permalink
require replace added for non editable fields (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
aniket-Kumar-c authored Dec 7, 2023
1 parent 1c050ee commit 497712d
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 24 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ on:
push:
branches:
- main
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'
- 'LICENSE'
- 'Makefile'
- 'docs/**'

jobs:
build:
Expand Down
6 changes: 3 additions & 3 deletions internal/resources/appservice_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ func AppServiceSchema() schema.Schema {
stringplanmodifier.UseStateForUnknown(),
},
},
"organization_id": stringAttribute(required),
"project_id": stringAttribute(required),
"cluster_id": stringAttribute(required),
"organization_id": stringAttribute(required, requiresReplace),
"project_id": stringAttribute(required, requiresReplace),
"cluster_id": stringAttribute(required, requiresReplace),
"name": stringAttribute(required, requiresReplace),
"description": stringDefaultAttribute("", optional, computed, requiresReplace),
"nodes": int64Attribute(optional, computed),
Expand Down
6 changes: 3 additions & 3 deletions internal/resources/backup_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ func BackupSchema() schema.Schema {
stringplanmodifier.UseStateForUnknown(),
},
},
"organization_id": stringAttribute(required),
"project_id": stringAttribute(required),
"cluster_id": stringAttribute(required),
"organization_id": stringAttribute(required, requiresReplace),
"project_id": stringAttribute(required, requiresReplace),
"cluster_id": stringAttribute(required, requiresReplace),
"bucket_id": stringAttribute(required, requiresReplace),
"cycle_id": stringAttribute(computed, useStateForUnknown),
"date": stringAttribute(computed, useStateForUnknown),
Expand Down
6 changes: 3 additions & 3 deletions internal/resources/bucket_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ func BucketSchema() schema.Schema {
},
},
"name": stringAttribute(required, requiresReplace),
"organization_id": stringAttribute(required),
"project_id": stringAttribute(required),
"cluster_id": stringAttribute(required),
"organization_id": stringAttribute(required, requiresReplace),
"project_id": stringAttribute(required, requiresReplace),
"cluster_id": stringAttribute(required, requiresReplace),
"type": stringDefaultAttribute("couchbase", optional, computed, requiresReplace),
"storage_backend": stringAttribute(optional, computed, requiresReplace),
"memory_allocation_in_mb": int64DefaultAttribute(100, optional, computed),
Expand Down
16 changes: 13 additions & 3 deletions internal/resources/cluster_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package resources

import (
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"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"
)
Expand All @@ -15,8 +16,8 @@ func ClusterSchema() schema.Schema {
stringplanmodifier.UseStateForUnknown(),
},
},
"organization_id": stringAttribute(required),
"project_id": stringAttribute(required),
"organization_id": stringAttribute(required, requiresReplace),
"project_id": stringAttribute(required, requiresReplace),
"name": stringAttribute(required),
"description": stringAttribute(optional, computed),
"cloud_provider": schema.SingleNestedAttribute{
Expand All @@ -26,14 +27,20 @@ func ClusterSchema() schema.Schema {
"region": stringAttribute(required),
"cidr": stringAttribute(required),
},
PlanModifiers: []planmodifier.Object{
objectplanmodifier.RequiresReplace(),
},
},
"configuration_type": stringAttribute(optional, computed),
"configuration_type": stringAttribute(optional, computed, requiresReplace),
"couchbase_server": schema.SingleNestedAttribute{
Optional: true,
Computed: true,
Attributes: map[string]schema.Attribute{
"version": stringAttribute(optional, computed),
},
PlanModifiers: []planmodifier.Object{
objectplanmodifier.RequiresReplace(),
},
},
"service_groups": schema.ListNestedAttribute{
Required: true,
Expand Down Expand Up @@ -72,6 +79,9 @@ func ClusterSchema() schema.Schema {
Attributes: map[string]schema.Attribute{
"type": stringAttribute(required),
},
PlanModifiers: []planmodifier.Object{
objectplanmodifier.RequiresReplace(),
},
},
"support": schema.SingleNestedAttribute{
Required: true,
Expand Down
6 changes: 3 additions & 3 deletions internal/resources/database_credential_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ func DatabaseCredentialSchema() schema.Schema {
},
"name": stringAttribute(required, requiresReplace),
"password": stringAttribute(optional, computed, sensitive, useStateForUnknown),
"organization_id": stringAttribute(required),
"project_id": stringAttribute(required),
"cluster_id": stringAttribute(required),
"organization_id": stringAttribute(required, requiresReplace),
"project_id": stringAttribute(required, requiresReplace),
"cluster_id": stringAttribute(required, requiresReplace),
"audit": computedAuditAttribute(),
"access": schema.ListNestedAttribute{
Optional: true,
Expand Down
2 changes: 1 addition & 1 deletion internal/resources/project_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func ProjectSchema() schema.Schema {
stringplanmodifier.UseStateForUnknown(),
},
},
"organization_id": stringAttribute(required),
"organization_id": stringAttribute(required, requiresReplace),
"name": stringAttribute(required),
"description": stringAttribute(optional, computed),
"if_match": stringAttribute(optional),
Expand Down
4 changes: 2 additions & 2 deletions internal/resources/user_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ func UserSchema() schema.Schema {
"name": stringAttribute(optional, computed),
"status": stringAttribute(computed),
"inactive": boolAttribute(computed),
"email": stringAttribute(required),
"organization_id": stringAttribute(required),
"email": stringAttribute(required, requiresReplace),
"organization_id": stringAttribute(required, requiresReplace),
"organization_roles": stringListAttribute(required),
"last_login": stringAttribute(computed),
"region": stringAttribute(computed),
Expand Down

0 comments on commit 497712d

Please sign in to comment.