Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ID migration changes #400

Merged
merged 10 commits into from
Dec 7, 2023
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
3 changes: 2 additions & 1 deletion docs/resources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ Import is supported using the following syntax:

```shell
# Clusters can be imported using the cluster id:
terraform import materialize_cluster.example_cluster <cluster_id>
terraform import materialize_cluster.example_cluster <region>:<cluster_id>

# Cluster id and information be found in the `mz_catalog.mz_clusters` table
# The region is the region where the database is located (e.g. aws/us-east-1)
```
3 changes: 2 additions & 1 deletion docs/resources/cluster_replica
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ Import is supported using the following syntax:

```shell
# Cluster replicas can be imported using the cluster replica id:
terraform import materialize_cluster_replica.example_1_cluster_replica <cluster_replica_id>
terraform import materialize_cluster_replica.example_1_cluster_replica <region>:<cluster_replica_id>

# Cluster replica id and information be found in the `mz_catalog.mz_cluster_replicas` table
# The region is the region where the database is located (e.g. aws/us-east-1)
```
3 changes: 2 additions & 1 deletion docs/resources/cluster_replica.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ Import is supported using the following syntax:

```shell
# Cluster replicas can be imported using the cluster replica id:
terraform import materialize_cluster_replica.example_1_cluster_replica <cluster_replica_id>
terraform import materialize_cluster_replica.example_1_cluster_replica <region>:<cluster_replica_id>

# Cluster replica id and information be found in the `mz_catalog.mz_cluster_replicas` table
# The region is the region where the database is located (e.g. aws/us-east-1)
```
3 changes: 2 additions & 1 deletion docs/resources/connection_aws_privatelink.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ Import is supported using the following syntax:

```shell
#Connections can be imported using the connection id:
terraform import materialize_connection_aws_privatelink.example <connection_id>
terraform import materialize_connection_aws_privatelink.example <region>:<connection_id>

# Connection id and information be found in the `mz_catalog.mz_connections` table
# The region is the region where the database is located (e.g. aws/us-east-1)
```
3 changes: 2 additions & 1 deletion docs/resources/connection_confluent_schema_registry.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ Import is supported using the following syntax:

```shell
#Connections can be imported using the connection id:
terraform import materialize_connection_confluent_schema_registry.example <connection_id>
terraform import materialize_connection_confluent_schema_registry.example <region>:<connection_id>

# Connection id and information be found in the `mz_catalog.mz_connections` table
# The region is the region where the database is located (e.g. aws/us-east-1)
```
5 changes: 3 additions & 2 deletions docs/resources/connection_kafka.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,9 @@ Optional:
Import is supported using the following syntax:

```shell
#Connections can be imported using the connection id:
terraform import materialize_connection_kafka.example <connection_id>
# Connections can be imported using the connection id:
terraform import materialize_connection_kafka.example <region>:<connection_id>

# Connection id and information be found in the `mz_catalog.mz_connections` table
# The region is the region where the database is located (e.g. aws/us-east-1)
```
5 changes: 4 additions & 1 deletion docs/resources/connection_postgres.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,8 @@ Import is supported using the following syntax:

```shell
# Connections can be imported using the connection id:
terraform import materialize_connection_postgres.example <connection_id>
terraform import materialize_connection_postgres.example <region>:<connection_id>

# Connection id and information be found in the `mz_catalog.mz_connections` table
# The region is the region where the database is located (e.g. aws/us-east-1)
```
3 changes: 2 additions & 1 deletion docs/resources/connection_ssh_tunnel.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ Import is supported using the following syntax:

```shell
#Connections can be imported using the connection id:
terraform import materialize_connection_ssh_tunnel.example <connection_id>
terraform import materialize_connection_ssh_tunnel.example <region>:<connection_id>

# Connection id and information be found in the `mz_catalog.mz_connections` table
# The region is the region where the database is located (e.g. aws/us-east-1)
```
3 changes: 2 additions & 1 deletion docs/resources/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ Import is supported using the following syntax:

```shell
# Indexes can be imported using the index id:
terraform import materialize_index.example_index <index_id>
terraform import materialize_index.example_index <region>:<index_id>

# Index id and information be found in the `mz_catalog.mz_indexes` table
# The region is the region where the database is located (e.g. aws/us-east-1)
```
3 changes: 2 additions & 1 deletion docs/resources/materialized_view.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ Import is supported using the following syntax:

```shell
# Materialized views can be imported using the materialized view id:
terraform import materialize_materialized_view.example_materialize_view <view_id>
terraform import materialize_materialized_view.example_materialize_view <region>:<view_id>

# Materialized view id and information be found in the `mz_catalog.mz_materialized_views` table
# The region is the region where the database is located (e.g. aws/us-east-1)
```
3 changes: 2 additions & 1 deletion docs/resources/role.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ Import is supported using the following syntax:

```shell
# Roles can be imported using the role id:
terraform import materialize_role.example_role <role_id>
terraform import materialize_role.example_role <region>:<role_id>

# Role id and information be found in the `mz_catalog.mz_roles` table
# The region is the region where the database is located (e.g. aws/us-east-1)
```
3 changes: 2 additions & 1 deletion docs/resources/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ Import is supported using the following syntax:

```shell
# Schemas can be imported using the schema id:
terraform import materialize_schema.example_schema <schema_id>
terraform import materialize_schema.example_schema <region>:<schema_id>

# Schema id and information be found in the `mz_catalog.mz_schemas` table
# The role is the role where the database is located (e.g. aws/us-east-1)
```
3 changes: 2 additions & 1 deletion docs/resources/secret.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ Import is supported using the following syntax:

```shell
# Secrets can be imported using the secret id:
terraform import materialize_secret.example_secret <secret_id>
terraform import materialize_secret.example_secret <region>:<secret_id>

# Secret id and information be found in the `mz_catalog.mz_secrets` table
# The region is the region where the database is located (e.g. aws/us-east-1)
```
3 changes: 2 additions & 1 deletion docs/resources/sink_kafka.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ Import is supported using the following syntax:

```shell
# Sinks can be imported using the sink id:
terraform import materialize_sink_kafka.example_sink_kafka <sink_id>
terraform import materialize_sink_kafka.example_sink_kafka <region>:<sink_id>

# Sink id and information be found in the `mz_catalog.mz_sinks` table
# The region is the region where the database is located (e.g. aws/us-east-1)
```
3 changes: 2 additions & 1 deletion docs/resources/source_kafka.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@ Import is supported using the following syntax:

```shell
# Sources can be imported using the source id:
terraform import materialize_source_kafka.example_source_kafka <source_id>
terraform import materialize_source_kafka.example_source_kafka <region>:<source_id>

# Source id and information be found in the `mz_catalog.mz_sources` table
# The region is the region where the database is located (e.g. aws/us-east-1)
```
3 changes: 2 additions & 1 deletion docs/resources/source_load_generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ Import is supported using the following syntax:

```shell
# Sources can be imported using the source id:
terraform import materialize_source_load_generator.example_source_load_generator <source_id>
terraform import materialize_source_load_generator.example_source_load_generator <region>:<source_id>

# Source id and information be found in the `mz_catalog.mz_sources` table
# The region is the region where the database is located (e.g. aws/us-east-1)
```
3 changes: 2 additions & 1 deletion docs/resources/source_postgres.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ Import is supported using the following syntax:

```shell
# Sources can be imported using the source id:
terraform import materialize_source_postgres.example_source_postgres <source_id>
terraform import materialize_source_postgres.example_source_postgres <region>:<source_id>

# Source id and information be found in the `mz_catalog.mz_sources` table
# The region is the region where the database is located (e.g. aws/us-east-1)
```
3 changes: 2 additions & 1 deletion docs/resources/source_webhook.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ Import is supported using the following syntax:

```shell
# Sources can be imported using the source id:
terraform import materialize_source_webhook.example_source_webhook <source_id>
terraform import materialize_source_webhook.example_source_webhook <region>:<source_id>

# Source id and information be found in the `mz_catalog.mz_sources` table
# The region is the region where the database is located (e.g. aws/us-east-1)
```
3 changes: 2 additions & 1 deletion docs/resources/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ Import is supported using the following syntax:

```shell
# Tables can be imported using the table id:
terraform import materialize_table.example_table <table_id>
terraform import materialize_table.example_table <region>:<table_id>

# Table id and information be found in the `mz_catalog.mz_tables` table
# The region is the region where the database is located (e.g. aws/us-east-1)
```
3 changes: 2 additions & 1 deletion docs/resources/type.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ Import is supported using the following syntax:

```shell
# Types can be imported using the type id:
terraform import materialize_type.example_type <type_id>
terraform import materialize_type.example_type <region>:<type_id>

# Type id and information be found in the `mz_catalog.mz_types` table
# The region is the region where the database is located (e.g. aws/us-east-1)
```
3 changes: 2 additions & 1 deletion docs/resources/view.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ Import is supported using the following syntax:

```shell
# Views can be imported using the view id:
terraform import materialize_view.example_view <view_id>
terraform import materialize_view.example_view <region>:<view_id>

# View id and information be found in the `mz_catalog.mz_views`
# The region is the region where the database is located (e.g. aws/us-east-1)
```
3 changes: 2 additions & 1 deletion examples/resources/materialize_cluster/import.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Clusters can be imported using the cluster id:
terraform import materialize_cluster.example_cluster <cluster_id>
terraform import materialize_cluster.example_cluster <region>:<cluster_id>

# Cluster id and information be found in the `mz_catalog.mz_clusters` table
# The region is the region where the database is located (e.g. aws/us-east-1)
3 changes: 2 additions & 1 deletion examples/resources/materialize_cluster_replica/import.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Cluster replicas can be imported using the cluster replica id:
terraform import materialize_cluster_replica.example_1_cluster_replica <cluster_replica_id>
terraform import materialize_cluster_replica.example_1_cluster_replica <region>:<cluster_replica_id>

# Cluster replica id and information be found in the `mz_catalog.mz_cluster_replicas` table
# The region is the region where the database is located (e.g. aws/us-east-1)
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#Connections can be imported using the connection id:
terraform import materialize_connection_aws_privatelink.example <connection_id>
terraform import materialize_connection_aws_privatelink.example <region>:<connection_id>

# Connection id and information be found in the `mz_catalog.mz_connections` table
# The region is the region where the database is located (e.g. aws/us-east-1)
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#Connections can be imported using the connection id:
terraform import materialize_connection_confluent_schema_registry.example <connection_id>
terraform import materialize_connection_confluent_schema_registry.example <region>:<connection_id>

# Connection id and information be found in the `mz_catalog.mz_connections` table
# The region is the region where the database is located (e.g. aws/us-east-1)
5 changes: 3 additions & 2 deletions examples/resources/materialize_connection_kafka/import.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#Connections can be imported using the connection id:
terraform import materialize_connection_kafka.example <connection_id>
# Connections can be imported using the connection id:
terraform import materialize_connection_kafka.example <region>:<connection_id>

# Connection id and information be found in the `mz_catalog.mz_connections` table
# The region is the region where the database is located (e.g. aws/us-east-1)
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Connections can be imported using the connection id:
terraform import materialize_connection_postgres.example <connection_id>
terraform import materialize_connection_postgres.example <region>:<connection_id>

# Connection id and information be found in the `mz_catalog.mz_connections` table
# The region is the region where the database is located (e.g. aws/us-east-1)
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#Connections can be imported using the connection id:
terraform import materialize_connection_ssh_tunnel.example <connection_id>
terraform import materialize_connection_ssh_tunnel.example <region>:<connection_id>

# Connection id and information be found in the `mz_catalog.mz_connections` table
# The region is the region where the database is located (e.g. aws/us-east-1)
3 changes: 2 additions & 1 deletion examples/resources/materialize_index/import.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Indexes can be imported using the index id:
terraform import materialize_index.example_index <index_id>
terraform import materialize_index.example_index <region>:<index_id>

# Index id and information be found in the `mz_catalog.mz_indexes` table
# The region is the region where the database is located (e.g. aws/us-east-1)
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Materialized views can be imported using the materialized view id:
terraform import materialize_materialized_view.example_materialize_view <view_id>
terraform import materialize_materialized_view.example_materialize_view <region>:<view_id>

# Materialized view id and information be found in the `mz_catalog.mz_materialized_views` table
# The region is the region where the database is located (e.g. aws/us-east-1)
3 changes: 2 additions & 1 deletion examples/resources/materialize_role/import.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Roles can be imported using the role id:
terraform import materialize_role.example_role <role_id>
terraform import materialize_role.example_role <region>:<role_id>

# Role id and information be found in the `mz_catalog.mz_roles` table
# The region is the region where the database is located (e.g. aws/us-east-1)
3 changes: 2 additions & 1 deletion examples/resources/materialize_schema/import.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Schemas can be imported using the schema id:
terraform import materialize_schema.example_schema <schema_id>
terraform import materialize_schema.example_schema <region>:<schema_id>

# Schema id and information be found in the `mz_catalog.mz_schemas` table
# The role is the role where the database is located (e.g. aws/us-east-1)
3 changes: 2 additions & 1 deletion examples/resources/materialize_secret/import.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Secrets can be imported using the secret id:
terraform import materialize_secret.example_secret <secret_id>
terraform import materialize_secret.example_secret <region>:<secret_id>

# Secret id and information be found in the `mz_catalog.mz_secrets` table
# The region is the region where the database is located (e.g. aws/us-east-1)
3 changes: 2 additions & 1 deletion examples/resources/materialize_sink_kafka/import.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Sinks can be imported using the sink id:
terraform import materialize_sink_kafka.example_sink_kafka <sink_id>
terraform import materialize_sink_kafka.example_sink_kafka <region>:<sink_id>

# Sink id and information be found in the `mz_catalog.mz_sinks` table
# The region is the region where the database is located (e.g. aws/us-east-1)
3 changes: 2 additions & 1 deletion examples/resources/materialize_source_kafka/import.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Sources can be imported using the source id:
terraform import materialize_source_kafka.example_source_kafka <source_id>
terraform import materialize_source_kafka.example_source_kafka <region>:<source_id>

# Source id and information be found in the `mz_catalog.mz_sources` table
# The region is the region where the database is located (e.g. aws/us-east-1)
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Sources can be imported using the source id:
terraform import materialize_source_load_generator.example_source_load_generator <source_id>
terraform import materialize_source_load_generator.example_source_load_generator <region>:<source_id>

# Source id and information be found in the `mz_catalog.mz_sources` table
# The region is the region where the database is located (e.g. aws/us-east-1)
3 changes: 2 additions & 1 deletion examples/resources/materialize_source_postgres/import.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Sources can be imported using the source id:
terraform import materialize_source_postgres.example_source_postgres <source_id>
terraform import materialize_source_postgres.example_source_postgres <region>:<source_id>

# Source id and information be found in the `mz_catalog.mz_sources` table
# The region is the region where the database is located (e.g. aws/us-east-1)
3 changes: 2 additions & 1 deletion examples/resources/materialize_source_webhook/import.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Sources can be imported using the source id:
terraform import materialize_source_webhook.example_source_webhook <source_id>
terraform import materialize_source_webhook.example_source_webhook <region>:<source_id>

# Source id and information be found in the `mz_catalog.mz_sources` table
# The region is the region where the database is located (e.g. aws/us-east-1)
3 changes: 2 additions & 1 deletion examples/resources/materialize_table/import.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Tables can be imported using the table id:
terraform import materialize_table.example_table <table_id>
terraform import materialize_table.example_table <region>:<table_id>

# Table id and information be found in the `mz_catalog.mz_tables` table
# The region is the region where the database is located (e.g. aws/us-east-1)
3 changes: 2 additions & 1 deletion examples/resources/materialize_type/import.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Types can be imported using the type id:
terraform import materialize_type.example_type <type_id>
terraform import materialize_type.example_type <region>:<type_id>

# Type id and information be found in the `mz_catalog.mz_types` table
# The region is the region where the database is located (e.g. aws/us-east-1)
3 changes: 2 additions & 1 deletion examples/resources/materialize_view/import.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Views can be imported using the view id:
terraform import materialize_view.example_view <view_id>
terraform import materialize_view.example_view <region>:<view_id>

# View id and information be found in the `mz_catalog.mz_views`
# The region is the region where the database is located (e.g. aws/us-east-1)
3 changes: 2 additions & 1 deletion pkg/datasources/datasource_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"

"github.com/MaterializeInc/terraform-provider-materialize/pkg/materialize"
"github.com/MaterializeInc/terraform-provider-materialize/pkg/utils"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand Down Expand Up @@ -77,6 +78,6 @@ func clusterRead(ctx context.Context, d *schema.ResourceData, meta interface{})
return diag.FromErr(err)
}

d.SetId("clusters")
d.SetId(utils.TransformIdWithRegion("clusters"))
return diags
}
3 changes: 2 additions & 1 deletion pkg/datasources/datasource_cluster_replica.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"

"github.com/MaterializeInc/terraform-provider-materialize/pkg/materialize"
"github.com/MaterializeInc/terraform-provider-materialize/pkg/utils"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand Down Expand Up @@ -77,6 +78,6 @@ func clusterReplicaRead(ctx context.Context, d *schema.ResourceData, meta interf
return diag.FromErr(err)
}

d.SetId("cluster_replicas")
d.SetId(utils.TransformIdWithRegion("cluster_replicas"))
return diags
}
Loading