Skip to content

Commit

Permalink
Merge branch 'ww-volume-snapshot-faraway-replica' into Prepare-for-1.…
Browse files Browse the repository at this point in the history
…0.0-release

# Conflicts:
#	pkg/provider/data_source_fareplica.go
  • Loading branch information
wai-wong-edb committed Aug 6, 2024
2 parents 9191806 + ab5be95 commit b578270
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 17 deletions.
13 changes: 5 additions & 8 deletions docs/data-sources/faraway_replica.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ output "csp_auth" {
value = coalesce(data.biganimal_faraway_replica.this.csp_auth, false)
}
output "deleted_at" {
value = data.biganimal_faraway_replica.this.deleted_at
}
output "expired_at" {
value = data.biganimal_faraway_replica.this.expired_at
}
output "instance_type" {
value = data.biganimal_faraway_replica.this.instance_type
}
Expand Down Expand Up @@ -111,6 +103,10 @@ output "resizing_pvc" {
output "storage" {
value = data.biganimal_faraway_replica.this.storage
}
output "volume_snapshot_backup" {
value = data.biganimal_faraway_replica.this.volume_snapshot_backup
}
```

<!-- schema generated by tfplugindocs -->
Expand Down Expand Up @@ -154,6 +150,7 @@ output "storage" {
- `source_cluster_id` (String) Source cluster ID.
- `storage` (Attributes) Storage. (see [below for nested schema](#nestedatt--storage))
- `transparent_data_encryption_action` (String) Transparent data encryption action.
- `volume_snapshot_backup` (Boolean) Enable to take a snapshot of the volume.

<a id="nestedatt--allowed_ip_ranges"></a>
### Nested Schema for `allowed_ip_ranges`
Expand Down
5 changes: 5 additions & 0 deletions docs/resources/faraway_replica.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ resource "biganimal_cluster" "single_node_cluster" {
# transparent_data_encryption = {
# key_id = <example_value>
# }
volume_snapshot_backup = false
}
output "password" {
Expand Down Expand Up @@ -119,6 +121,8 @@ resource "biganimal_faraway_replica" "faraway_replica" {
# transparent_data_encryption = {
# key_id = <example_value>
# }
volume_snapshot_backup = false
}
```

Expand All @@ -145,6 +149,7 @@ resource "biganimal_faraway_replica" "faraway_replica" {
- `service_account_ids` (Set of String) A Google Cloud Service Account is used for logs. If you leave this blank, then you will be unable to access log details for this cluster. Required when cluster is deployed on BigAnimal's cloud account.
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
- `transparent_data_encryption` (Attributes) Transparent Data Encryption (TDE) key (see [below for nested schema](#nestedatt--transparent_data_encryption))
- `volume_snapshot_backup` (Boolean) Enable to take a snapshot of the volume.

### Read-Only

Expand Down
12 changes: 4 additions & 8 deletions examples/data-sources/biganimal_faraway_replica/data-source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ output "csp_auth" {
value = coalesce(data.biganimal_faraway_replica.this.csp_auth, false)
}

output "deleted_at" {
value = data.biganimal_faraway_replica.this.deleted_at
}

output "expired_at" {
value = data.biganimal_faraway_replica.this.expired_at
}

output "instance_type" {
value = data.biganimal_faraway_replica.this.instance_type
}
Expand Down Expand Up @@ -96,3 +88,7 @@ output "resizing_pvc" {
output "storage" {
value = data.biganimal_faraway_replica.this.storage
}

output "volume_snapshot_backup" {
value = data.biganimal_faraway_replica.this.volume_snapshot_backup
}
2 changes: 2 additions & 0 deletions examples/resources/biganimal_faraway_replica/aws/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,6 @@ resource "biganimal_faraway_replica" "faraway_replica" {
# transparent_data_encryption = {
# key_id = <example_value>
# }

volume_snapshot_backup = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,6 @@ resource "biganimal_faraway_replica" "faraway_replica" {
# transparent_data_encryption = {
# key_id = <example_value>
# }

volume_snapshot_backup = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ resource "biganimal_cluster" "single_node_cluster" {
# transparent_data_encryption = {
# key_id = <example_value>
# }

volume_snapshot_backup = false
}

output "password" {
Expand Down Expand Up @@ -107,4 +109,6 @@ resource "biganimal_faraway_replica" "faraway_replica" {
# transparent_data_encryption = {
# key_id = <example_value>
# }

volume_snapshot_backup = false
}
2 changes: 2 additions & 0 deletions examples/resources/biganimal_faraway_replica/gcp/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,6 @@ resource "biganimal_faraway_replica" "faraway_replica" {
# transparent_data_encryption = {
# key_id = <example_value>
# }

volume_snapshot_backup = false
}
5 changes: 4 additions & 1 deletion pkg/provider/data_source_fareplica.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,13 @@ func (c *FAReplicaData) Schema(ctx context.Context, req datasource.SchemaRequest
Description: "Cloud provider. For example, \"aws\", \"azure\", \"gcp\" or \"bah:aws\", \"bah:gcp\".",
Computed: true,
},
"volume_snapshot_backup": schema.BoolAttribute{
MarkdownDescription: "Enable to take a snapshot of the volume.",
Computed: true,
},
"transparent_data_encryption": schema.SingleNestedAttribute{
MarkdownDescription: "Transparent Data Encryption (TDE) key",
Optional: true,

Attributes: map[string]schema.Attribute{
"key_id": schema.StringAttribute{
MarkdownDescription: "Transparent Data Encryption (TDE) key ID.",
Expand Down
7 changes: 7 additions & 0 deletions pkg/provider/resource_fareplica.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ type FAReplicaResourceModel struct {
TransparentDataEncryption *TransparentDataEncryptionModel `tfsdk:"transparent_data_encryption"`
PgIdentity types.String `tfsdk:"pg_identity"`
TransparentDataEncryptionAction types.String `tfsdk:"transparent_data_encryption_action"`
VolumeSnapshot types.Bool `tfsdk:"volume_snapshot_backup"`

Timeouts timeouts.Value `tfsdk:"timeouts"`
}
Expand Down Expand Up @@ -381,6 +382,11 @@ func (r *FAReplicaResource) Schema(ctx context.Context, req resource.SchemaReque
Computed: true,
PlanModifiers: []planmodifier.String{plan_modifier.CustomTDEAction()},
},
"volume_snapshot_backup": schema.BoolAttribute{
MarkdownDescription: "Enable to take a snapshot of the volume.",
Optional: true,
PlanModifiers: []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()},
},
},
}
}
Expand Down Expand Up @@ -594,6 +600,7 @@ func readFAReplica(ctx context.Context, client *api.ClusterClient, fAReplicaReso
fAReplicaResourceModel.CloudProvider = types.StringValue(responseCluster.Provider.CloudProviderId)
fAReplicaResourceModel.PgVersion = types.StringValue(responseCluster.PgVersion.PgVersionId)
fAReplicaResourceModel.PgType = types.StringValue(responseCluster.PgType.PgTypeId)
fAReplicaResourceModel.VolumeSnapshot = types.BoolPointerValue(responseCluster.VolumeSnapshot)

// pgConfig. If tf resource pg config elem matches with api response pg config elem then add the elem to tf resource pg config
newPgConfig := []PgConfigResourceModel{}
Expand Down

0 comments on commit b578270

Please sign in to comment.