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

Bug: timescale_peering_connection resource not idempotent #177

Closed
dennisameling opened this issue Mar 19, 2024 · 1 comment · Fixed by #178
Closed

Bug: timescale_peering_connection resource not idempotent #177

dennisameling opened this issue Mar 19, 2024 · 1 comment · Fixed by #178

Comments

@dennisameling
Copy link

dennisameling commented Mar 19, 2024

Hi Timescale team,

We're currently using version 1.8.0 of your Terraform provider, and are excited to see the continuous improvements and feature enhancements you're doing. We use the timescale_peering_connection resource to set up the peering connections.

While this works for the most part, we ran into a situation where we had to remove two peering connections manually through the Timescale Cloud Console. Terraform didn't recognize that they were removed and didn't try to recreate them.

Expected behavior

We expect the timescale_peering_connection resource to be idempotent, so that if a resource is removed manually through the Timescale console, Terraform should recreate it next time we run a terraform plan. Other Terraform providers like the AWS Terraform provider also work this way.

Actual behavior

When running a terraform plan after the resources were removed manually, these errors showed up:

│ Error: Value Conversion Error
│ 
│   with timescale_peering_connection.timescale_peering["REDACTED"],
│   on timescale.tf line 139, in resource "timescale_peering_connection" "timescale_peering":
│  139:   peer_account_id  = each.value.aws_account_id
│ 
│ An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the following to the provider developer:
│ 
│ Received null value, however the target type cannot handle null values. Use the corresponding `types` package type, a pointer type or a custom type that handles null values.
│ 
│ Path: peer_account_id
│ Target Type: string
│ Suggested `types` Type: basetypes.StringValue
│ Suggested Pointer Type: *string
╵
╷
│ Error: Value Conversion Error
│ 
│   with timescale_peering_connection.timescale_peering["REDACTED"],
│   on timescale.tf line 140, in resource "timescale_peering_connection" "timescale_peering":
│  140:   peer_region_code = local.region
│ 
│ An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the following to the provider developer:
│ 
│ Received null value, however the target type cannot handle null values. Use the corresponding `types` package type, a pointer type or a custom type that handles null values.
│ 
│ Path: peer_region_code
│ Target Type: string
│ Suggested `types` Type: basetypes.StringValue
│ Suggested Pointer Type: *string
╵
╷
│ Error: Value Conversion Error
│ 
│   with timescale_peering_connection.timescale_peering["REDACTED"],
│   on timescale.tf line 141, in resource "timescale_peering_connection" "timescale_peering":
│  141:   peer_vpc_id      = each.value.vpc_id
│ 
│ An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the following to the provider developer:
│ 
│ Received null value, however the target type cannot handle null values. Use the corresponding `types` package type, a pointer type or a custom type that handles null values.
│ 
│ Path: peer_vpc_id
│ Target Type: string
│ Suggested `types` Type: basetypes.StringValue
│ Suggested Pointer Type: *string
╵
╷
│ Error: Value Conversion Error
│ 
│   with timescale_peering_connection.timescale_peering["REDACTED"],
│   on timescale.tf line 142, in resource "timescale_peering_connection" "timescale_peering":
│  142:   timescale_vpc_id = timescale_vpcs.timescale_vpc.id
│ 
│ An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the following to the provider developer:
│ 
│ Received null value, however the target type cannot handle null values. Use the corresponding `types` package type, a pointer type or a custom type that handles null values.
│ 
│ Path: timescale_vpc_id
│ Target Type: int64
│ Suggested `types` Type: basetypes.Int64Value
│ Suggested Pointer Type: *int64

We then had to remove the resources from the Terraform state manually through:

terraform state rm "timescale_peering_connection.timescale_peering[\"REDACTED\"]"

Please let me know if you need any additional information from our side. Thanks!

@Khyme
Copy link
Contributor

Khyme commented Mar 19, 2024

Thank you for your feedback.
Found a fix for this, I'll release it asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants