Skip to content

Commit

Permalink
fix(warehouse): transactional credentials drift changes (#85)
Browse files Browse the repository at this point in the history
* fix(warehouse): transactional credentials drift changes

* fix(warehouse): transactional - database name updatable
  • Loading branch information
ndopj authored Feb 18, 2024
1 parent fd7aad4 commit e27dee0
Show file tree
Hide file tree
Showing 5 changed files with 208 additions and 72 deletions.
16 changes: 8 additions & 8 deletions internal/warehouse/bigquery_warehouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ type BigQueryWarehouseResource struct {

// BigQueryWarehouseResourceModel describes the resource data model according to its Schema.
type BigQueryWarehouseResourceModel struct {
Uuid types.String `tfsdk:"uuid"`
Credentials Credentials `tfsdk:"credentials"`
Name types.String `tfsdk:"name"`
CollectorUuid types.String `tfsdk:"collector_uuid"`
DeletionProtection types.Bool `tfsdk:"deletion_protection"`
Uuid types.String `tfsdk:"uuid"`
Credentials BqCredentials `tfsdk:"credentials"`
Name types.String `tfsdk:"name"`
CollectorUuid types.String `tfsdk:"collector_uuid"`
DeletionProtection types.Bool `tfsdk:"deletion_protection"`
}

type Credentials struct {
type BqCredentials struct {
ConnectionUuid types.String `tfsdk:"connection_uuid"`
ServiceAccountKey types.String `tfsdk:"service_account_key"`
UpdatedAt types.String `tfsdk:"updated_at"`
Expand Down Expand Up @@ -75,7 +75,7 @@ func (r *BigQueryWarehouseResource) Metadata(ctx context.Context, req resource.M

func (r *BigQueryWarehouseResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = schema.Schema{
Version: 1,
Version: 2,
Attributes: map[string]schema.Attribute{
"uuid": schema.StringAttribute{
Computed: true,
Expand Down Expand Up @@ -495,7 +495,7 @@ func (r *BigQueryWarehouseResource) UpgradeState(ctx context.Context) map[int64]
CollectorUuid: priorStateData.CollectorUuid,
Name: priorStateData.Name,
DeletionProtection: priorStateData.DeletionProtection,
Credentials: Credentials{
Credentials: BqCredentials{
ConnectionUuid: priorStateData.ConnectionUuid,
ServiceAccountKey: priorStateData.ServiceAccountKey,
UpdatedAt: types.StringNull(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ resource "montecarlo_transactional_warehouse" "test" {
db_type = "POSTGRES" # POSTGRES | MYSQL | SQL-SERVER
deletion_protection = false

configuration = {
credentials = {
host = var.pg_host
port = var.pg_port
database = var.pg_database
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ resource "montecarlo_transactional_warehouse" "test" {
db_type = "POSTGRES" # POSTGRES | MYSQL | SQL-SERVER
deletion_protection = false

configuration = {
credentials = {
host = var.pg_host
port = var.pg_port
database = var.pg_database
Expand Down
Loading

0 comments on commit e27dee0

Please sign in to comment.