Closed michael-sterling closed 6 months ago
Thanks, @michael-sterling, for the well-documented issue! We will investigate and circle back 👍
@michael-sterling thanks again for the report! We've worked on fix with #54 -- 0.2.1 is tagged with this. If you run into anything else, happy to help.
Summary
I am trying to adopt this provider for an existing Redirect Pizza instance. I would like to import existing redirects to be managed by Terraform.
However the
sources
array anddestination
blocks do not get populated with the existing values whenimport
ing an existing redirect from from the API.Further, when I test making a change to a redirect already managed by Terraform, refreshing the Terraform state using
terraform plan -refresh-only
does not pick up any changes I have made to Sources or Destinations using the https://redirect.pizza website UI for that redirect. This means that Terraform will not know that it needs to update that redirect in order to cause the redirect to match Terraform configuration again.I suspect that this is due to mapping errors translating the API JSON for a redirect into the shape expected by Terraform state.
Relevant Code
sources
array.sources
property gets assigned an array of{ url: string }
objects.[ERROR] setting state: sources.0: '' expected type 'string', got unconvertible type 'map[string]interface {}'
error.destination
blocks property-by-property.[ERROR] setting state: destination.0.url: can only set full list
errors.Steps to Reproduce
Provider Version:
0.2.0
Terraform Version:1.6.6
Note: To reproduce outside of my environment, you will need your own API token and the ID of an existing redirect. The ID I used in the below example is
1624710909
.Example Terraform
Command to Reproduce
terraform plan
Output
Note that:
keep_query_string
,redirect_type
, andtags
tracking
anduri_forwarding
sources
ordestination
Terraform State
If I run the import manually using
terraform import redirectpizza_redirect.example 1624710909
, the resulting resource state looks like this (again withoutsources
ordestination
):Logs
Using
TF_LOG = 'DEBUG'
I see these events in the logs: