Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 29 additions & 29 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ import (
"github.com/hashicorp/terraform-plugin-framework/types"

"github.com/appwrite/terraform-provider-appwrite/internal/common"
"github.com/appwrite/terraform-provider-appwrite/internal/services/backup"
"github.com/appwrite/terraform-provider-appwrite/internal/services/bucket"
"github.com/appwrite/terraform-provider-appwrite/internal/services/column"
"github.com/appwrite/terraform-provider-appwrite/internal/services/database"
appwritefile "github.com/appwrite/terraform-provider-appwrite/internal/services/file"
"github.com/appwrite/terraform-provider-appwrite/internal/services/index"
messagingprovider "github.com/appwrite/terraform-provider-appwrite/internal/services/provider"
"github.com/appwrite/terraform-provider-appwrite/internal/services/row"
"github.com/appwrite/terraform-provider-appwrite/internal/services/subscriber"
"github.com/appwrite/terraform-provider-appwrite/internal/services/table"
"github.com/appwrite/terraform-provider-appwrite/internal/services/team"
"github.com/appwrite/terraform-provider-appwrite/internal/services/topic"
"github.com/appwrite/terraform-provider-appwrite/internal/services/user"
"github.com/appwrite/terraform-provider-appwrite/internal/services/webhook"
backupsvc "github.com/appwrite/terraform-provider-appwrite/internal/services/backup"
bucketsvc "github.com/appwrite/terraform-provider-appwrite/internal/services/bucket"
columnsvc "github.com/appwrite/terraform-provider-appwrite/internal/services/column"
databasesvc "github.com/appwrite/terraform-provider-appwrite/internal/services/database"
filesvc "github.com/appwrite/terraform-provider-appwrite/internal/services/file"
indexsvc "github.com/appwrite/terraform-provider-appwrite/internal/services/index"
providersvc "github.com/appwrite/terraform-provider-appwrite/internal/services/provider"
rowsvc "github.com/appwrite/terraform-provider-appwrite/internal/services/row"
subscribersvc "github.com/appwrite/terraform-provider-appwrite/internal/services/subscriber"
tablesvc "github.com/appwrite/terraform-provider-appwrite/internal/services/table"
teamsvc "github.com/appwrite/terraform-provider-appwrite/internal/services/team"
topicsvc "github.com/appwrite/terraform-provider-appwrite/internal/services/topic"
usersvc "github.com/appwrite/terraform-provider-appwrite/internal/services/user"
webhooksvc "github.com/appwrite/terraform-provider-appwrite/internal/services/webhook"
)

var _ provider.Provider = &appwriteProvider{}
Expand Down Expand Up @@ -138,26 +138,26 @@ func (p *appwriteProvider) Configure(ctx context.Context, req provider.Configure

func (p *appwriteProvider) Resources(_ context.Context) []func() resource.Resource {
return []func() resource.Resource{
database.NewDatabaseResource,
table.NewTableResource,
column.NewColumnResource,
index.NewIndexResource,
bucket.NewBucketResource,
topic.NewTopicResource,
messagingprovider.NewProviderResource,
user.NewUserResource,
team.NewTeamResource,
backup.NewPolicyResource,
row.NewRowResource,
webhook.NewWebhookResource,
subscriber.NewSubscriberResource,
appwritefile.NewFileResource,
databasesvc.NewDatabaseResource,
tablesvc.NewTableResource,
columnsvc.NewColumnResource,
indexsvc.NewIndexResource,
bucketsvc.NewBucketResource,
topicsvc.NewTopicResource,
providersvc.NewProviderResource,
usersvc.NewUserResource,
teamsvc.NewTeamResource,
backupsvc.NewPolicyResource,
rowsvc.NewRowResource,
webhooksvc.NewWebhookResource,
subscribersvc.NewSubscriberResource,
filesvc.NewFileResource,
}
}

func (p *appwriteProvider) DataSources(_ context.Context) []func() datasource.DataSource {
return []func() datasource.DataSource{
database.NewDatabaseDataSource,
databasesvc.NewDatabaseDataSource,
}
}

Expand Down
2 changes: 1 addition & 1 deletion internal/services/backup/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (r *policyResource) Schema(_ context.Context, _ resource.SchemaRequest, res
Description: "The backup policy ID.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()},
},
"name": schema.StringAttribute{
Description: "The backup policy name.",
Expand Down
10 changes: 4 additions & 6 deletions internal/services/bucket/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,10 @@ func (r *bucketResource) Schema(_ context.Context, _ resource.SchemaRequest, res
Description: "Manages an Appwrite storage bucket.",
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Description: "The bucket ID. Must be unique within the project.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Description: "The bucket ID. Must be unique within the project.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()},
},
"name": schema.StringAttribute{
Description: "The bucket name.",
Expand Down
2 changes: 1 addition & 1 deletion internal/services/column/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (r *columnResource) Schema(_ context.Context, _ resource.SchemaRequest, res
Description: "The column key (name).",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()},
},
"type": schema.StringAttribute{
Description: "The column type. One of: " + allColumnTypes + ".",
Expand Down
10 changes: 4 additions & 6 deletions internal/services/database/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@ func (r *databaseResource) Schema(_ context.Context, _ resource.SchemaRequest, r
Description: "Manages an Appwrite database.",
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Description: "The database ID. Must be unique within the project.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Description: "The database ID. Must be unique within the project.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()},
},
"name": schema.StringAttribute{
Description: "The database name.",
Expand Down
2 changes: 1 addition & 1 deletion internal/services/file/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (r *fileResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
Description: "The file ID.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()},
},
"bucket_id": schema.StringAttribute{
Description: "The bucket ID.",
Expand Down
2 changes: 1 addition & 1 deletion internal/services/index/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (r *indexResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
Description: "The index key (name).",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()},
},
"type": schema.StringAttribute{
Description: "Index type: key, unique, or fulltext.",
Expand Down
18 changes: 7 additions & 11 deletions internal/services/provider/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,19 @@ func (r *providerResource) Schema(_ context.Context, _ resource.SchemaRequest, r
Description: "Manages an Appwrite messaging provider.",
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Description: "The provider ID.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Description: "The provider ID.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()},
},
"name": schema.StringAttribute{
Description: "The provider name.",
Required: true,
},
"type": schema.StringAttribute{
Description: "The provider type. One of: sendgrid, mailgun, smtp, resend, twilio, vonage, msg91, telesign, textmagic, apns, fcm.",
Required: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Description: "The provider type. One of: sendgrid, mailgun, smtp, resend, twilio, vonage, msg91, telesign, textmagic, apns, fcm.",
Required: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
},
"enabled": schema.BoolAttribute{
Description: "Whether the provider is enabled.",
Expand Down
2 changes: 1 addition & 1 deletion internal/services/row/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (r *rowResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *
Description: "The row ID.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()},
},
"database_id": schema.StringAttribute{
Description: "The database ID.",
Expand Down
2 changes: 1 addition & 1 deletion internal/services/subscriber/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (r *subscriberResource) Schema(_ context.Context, _ resource.SchemaRequest,
Description: "The subscriber ID.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()},
},
"topic_id": schema.StringAttribute{
Description: "The topic ID to subscribe to.",
Expand Down
30 changes: 12 additions & 18 deletions internal/services/table/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,15 @@ func (r *tableResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
Description: "Manages an Appwrite table within a database.",
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Description: "The table ID. Must be unique within the database.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Description: "The table ID. Must be unique within the database.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()},
},
"database_id": schema.StringAttribute{
Description: "The ID of the database this table belongs to.",
Required: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Description: "The ID of the database this table belongs to.",
Required: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
},
"name": schema.StringAttribute{
Description: "The table name.",
Expand All @@ -83,13 +79,11 @@ func (r *tableResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
Default: booldefault.StaticBool(false),
},
"permissions": schema.ListAttribute{
Description: "Table-level permissions.",
Optional: true,
Computed: true,
ElementType: types.StringType,
PlanModifiers: []planmodifier.List{
listplanmodifier.UseStateForUnknown(),
},
Description: "Table-level permissions.",
Optional: true,
Computed: true,
ElementType: types.StringType,
PlanModifiers: []planmodifier.List{listplanmodifier.UseStateForUnknown()},
},
"created_at": schema.StringAttribute{
Description: "The table creation timestamp.",
Expand Down
2 changes: 1 addition & 1 deletion internal/services/team/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (r *teamResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
Description: "The team ID.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()},
},
"name": schema.StringAttribute{
Description: "The team name.",
Expand Down
10 changes: 4 additions & 6 deletions internal/services/topic/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,10 @@ func (r *topicResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
Description: "Manages an Appwrite messaging topic.",
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Description: "The topic ID.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Description: "The topic ID.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()},
},
"name": schema.StringAttribute{
Description: "The topic name.",
Expand Down
2 changes: 1 addition & 1 deletion internal/services/user/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (r *userResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
Description: "The user ID.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()},
},
"name": schema.StringAttribute{
Description: "The user name.",
Expand Down
2 changes: 1 addition & 1 deletion internal/services/webhook/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (r *webhookResource) Schema(_ context.Context, _ resource.SchemaRequest, re
Description: "The webhook ID.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace(), stringplanmodifier.UseStateForUnknown()},
},
"name": schema.StringAttribute{
Description: "The webhook name.",
Expand Down
Loading