Closed emerkle826 closed 1 month ago
Hi there,
Please provide the following details with your issue report.
Terraform v1.9.8 on linux_amd64 + provider registry.terraform.io/datastax/astra v2.3.8
Please list the resources as a list, for example:
main.tf
terraform { required_providers { astra = { source = "datastax/astra" version = "2.3.8" } } } module "testing" { source = "./modules/testing" } resource astra_database "terra74" { name = "terra74" keyspace = "testks" cloud_provider = "aws" regions = ["us-east-1"] deletion_protection = false } resource "astra_table" "table" { table = "table1" keyspace = astra_database.terra74.keyspace database_id = astra_database.terra74.id region = "us-east-1" clustering_columns = "a:b" partition_keys = "c:d" column_definitions = module.testing.column_defs }
modules/testing/variables.tf
variable "column_definitions" { type = list(map(string)) default = [ { Name: "a" Static: false TypeDefinition: "text" }, { Name: "b" Static: false TypeDefinition: "text" }, { Name: "c" Static: false TypeDefinition: "text" }, { Name: "d" Static: false TypeDefinition: "text" }, { Name: "e" Static: false TypeDefinition: "text" }, { Name: "f" Static: false TypeDefinition: "text" } ] }
modules/testing/outputs.tf
output "column_defs" { value = var.column_definitions }
# astra_table.table: resource "astra_table" "table" { clustering_columns = "a:b" column_definitions = [ { "Name" = "a" "Static" = "false" "TypeDefinition" = "text" }, { "Name" = "b" "Static" = "false" "TypeDefinition" = "text" }, { "Name" = "c" "Static" = "false" "TypeDefinition" = "text" }, { "Name" = "d" "Static" = "false" "TypeDefinition" = "text" }, { "Name" = "e" "Static" = "false" "TypeDefinition" = "text" }, { "Name" = "f" "Static" = "false" "TypeDefinition" = "text" }, ] database_id = "50a08b2f-30c9-4065-8de3-8f1ab31b0151" id = "50a08b2f-30c9-4065-8de3-8f1ab31b0151/testks/table1" keyspace = "testks" partition_keys = "c:d" region = "us-east-1" table = "table1" }
When the table is imported in Step 4 above, the table definition is missing partition_keys, clustering_columns and column_definitions:
partition_keys
clustering_columns
column_definitions
# astra_table.table: resource "astra_table" "table" { database_id = "50a08b2f-30c9-4065-8de3-8f1ab31b0151" id = "50a08b2f-30c9-4065-8de3-8f1ab31b0151/testks/table1" keyspace = "testks" region = "us-east-1" table = "table1" }
terraform init
terraform apply
terraform show
terraform rm astra_table.table
terraform import astra_table.table 50a08b2f-30c9-4065-8de3-8f1ab31b0151/us-east-1/testks/table1
Awesome, thanks for the quick fix!
Hi there,
Please provide the following details with your issue report.
Terraform Version
Affected Resource(s)
Please list the resources as a list, for example:
Terraform Configuration Files
main.tf
modules/testing/variables.tf
modules/testing/outputs.tf
Debug Output
Panic Output
Expected Behavior
Actual Behavior
When the table is imported in Step 4 above, the table definition is missing
partition_keys
,clustering_columns
andcolumn_definitions
:Steps to Reproduce
terraform init
terraform apply
terraform show
(verify full table definition)terraform rm astra_table.table
terraform show
(verify table is no longer in the terraform state)terraform import astra_table.table 50a08b2f-30c9-4065-8de3-8f1ab31b0151/us-east-1/testks/table1
terraform show
(should see full table definition but it is missing data)Important Factoids
References