pactflow / terraform-provider-pact

Terraform provider for Pact Broker (and Pactflow)
https://pactflow.io
MIT License
24 stars 4 forks source link

Import of pact_pacticipant resource doesn't produce a correct state #11

Closed vgrigoruk closed 3 years ago

vgrigoruk commented 3 years ago

Importing of pact_pacticipant resources doesn't work correctly. Running terraform plan after terraform import produces a diff, which requires re-creation of the imported pact_pacticipant resource.

❯ TF_VAR_token=******** terraform plan             
pact_pacticipant.dashboard: Refreshing state... [id=dashboard]

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement

Terraform will perform the following actions:

  # pact_pacticipant.dashboard must be replaced
-/+ resource "pact_pacticipant" "dashboard" {
      ~ id   = "dashboard" -> (known after apply)
      + name = "dashboard" # forces replacement
    }

Plan: 1 to add, 0 to change, 1 to destroy.

Terraform Version

$ terraform -v
Terraform v0.14.3
+ provider registry.terraform.io/pactflow/pact v0.1.3

Affected Resource(s)

Please list the resources as a list, for example:

Terraform Configuration Files

resource "pact_pacticipant" "dashboard" {
  name = "dashboard"
}

Expected Behavior

pact_pacticipant resource doesn't need to be destroyed and re-created.

Actual Behavior

pact_pacticipant resource needs to be destroyed and re-created.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform import pact_pacticipant.dashboard dashboard
  2. terraform plan
mefellows commented 3 years ago

Thanks for the report. I'll get this fixed today, and publish some of the latest changes also.

mefellows commented 3 years ago

Hi @vgrigoruk, I've pushed out a release today for v0.1.4. We're still getting it into shape as the features progress, but I'm happier with the resources. Feedback welcome of course.

I haven't written up migration notes, but the previous pact_role has been moved to pact_role_v1 and is now deprecated in favour of adding roles directly to the pact_user resource.

The pact_token resource I'm still in two minds about keeping.

Anyway, see how you get on - it should fix this specific issue.