terraform-provider-codefresh icon indicating copy to clipboard operation
terraform-provider-codefresh copied to clipboard

[Bug]: Missing resources cause provider to fail

Open dmikalova opened this issue 2 years ago • 0 comments

What happened?

After manually removing a resource from codefresh, a subsequent terraform run errors out bc the API respond that the resource no longer exists. The TF provider should instead handle this to mean that the resource no longer exists and then tries to recreate it.

TF error:

╷
│ Error: 500 Internal Server Error, {"status":500,"code":"1001","name":"INTERNAL_SERVER_ERROR","message":"Internal server error","context":{}}
│ 
│   with codefresh_registry.aws_ecr_prod_usw2,
│   on ecr.tf line 1, in resource "codefresh_registry" "aws_ecr_prod_usw2":
│    1: resource "codefresh_registry" "aws_ecr_prod_usw2" {
│ 
╵
[01H2TSVYBV0A9ZAWNQD8Q5TSHR] Unexpected exit code when planning changes: 1

Version

codefresh-io/codefresh v0.4.1

Relevant Terraform Configuration

# Apply this, delete the registry manually in codefresh, and then try to apply again
resource "codefresh_registry" "aws_ecr_prod_usw2" {
  default = true
  name    = "aws-ecr-prod-usw2"
  primary = true

  spec {
    ecr {
      access_key_id     = var.ecr_aws_access_key_id_prod_usw2
      region            = "us-west-2"
      secret_access_key = var.ecr_aws_secret_access_key_prod_usw2
    }
  }
}

dmikalova avatar Jun 26 '23 21:06 dmikalova