steep-salesclerk-99119
09/28/2024, 7:28 PMpulumi up
, even though the underlying Terraform provider is working correctly.
Here's the context:
1. I've built a Terraform provider (github.com/pgEdge/terraform-provider-pgedge) using terraform-plugin-framework.
2. I've then created a Pulumi provider (github.com/pgEdge/pulumi-pgedge, sync-v007 branch) using pulumi-terraform-bridge.
The issue is with a field called "nodes" in my database resource. Here's the full schema for the "nodes" field:
go
"nodes": schema.ListNestedAttribute{
Description: "List of nodes in the database.",
Computed: true,
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"name": schema.StringAttribute{
Computed: true,
Optional: true,
},
"connection": schema.SingleNestedAttribute{
Computed: true,
PlanModifiers: []planmodifier.Object{
objectplanmodifier.UseStateForUnknown(),
},
Attributes: map[string]schema.Attribute{
"database": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}},
"host": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}},
"password": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}},
"port": schema.Int64Attribute{Computed: true, PlanModifiers: []planmodifier.Int64{int64planmodifier.UseStateForUnknown()}},
"username": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}},
"external_ip_address": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}},
"internal_ip_address": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}},
"internal_host": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}},
},
},
"location": schema.SingleNestedAttribute{
Computed: true,
PlanModifiers: []planmodifier.Object{
objectplanmodifier.UseStateForUnknown(),
},
Attributes: map[string]schema.Attribute{
"code": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}},
"country": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}},
"latitude": schema.Float64Attribute{Computed: true, PlanModifiers: []planmodifier.Float64{float64planmodifier.UseStateForUnknown()}},
"longitude": schema.Float64Attribute{Computed: true, PlanModifiers: []planmodifier.Float64{float64planmodifier.UseStateForUnknown()}},
"name": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}},
"region": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}},
"region_code": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}},
"timezone": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}},
"postal_code": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}},
"metro_code": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}},
"city": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}},
},
},
"region": schema.SingleNestedAttribute{
Computed: true,
PlanModifiers: []planmodifier.Object{
objectplanmodifier.UseStateForUnknown(),
},
Attributes: map[string]schema.Attribute{
"active": schema.BoolAttribute{Computed: true, PlanModifiers: []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()}},
"availability_zones": schema.ListAttribute{Computed: true, ElementType: types.StringType, PlanModifiers: []planmodifier.List{listplanmodifier.UseStateForUnknown()}},
"cloud": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}},
"code": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}},
"name": schema.StringAttribute{Computed: true, PlanModifier
s: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}},
"parent": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}},
},
},
"extensions": schema.SingleNestedAttribute{
Computed: true,
PlanModifiers: []planmodifier.Object{
conditionalUseStateForUnknownModifier{},
},
Attributes: map[string]schema.Attribute{
"errors": schema.MapAttribute{Computed: true, ElementType: types.StringType, PlanModifiers: []planmodifier.Map{mapplanmodifier.UseStateForUnknown()}},
"installed": schema.ListAttribute{Computed: true, ElementType: types.StringType, PlanModifiers: []planmodifier.List{listplanmodifier.UseStateForUnknown()}},
},
},
},
},
},
The expected behavior is that when creating the resource, it should create the nodes, and then removing or adding something like {name: "new_node"}
in the array should trigger an update. This works correctly in the Terraform provider.
However, the Pulumi provider never detects any changes to the "nodes" field at all, so it doesn't trigger an update on pulumi up
. I've confirmed that the nodes are being saved correctly, but Pulumi isn't recognizing the changes.
Here are my questions:
1. Is this issue related to the use of custom plan modifiers, particularly the conditionalUseStateForUnknownModifier{}
in the "extensions" attribute?
2. Does pulumi-terraform-bridge fully support custom plan modifiers from terraform-plugin-framework?
3. Could the extensive use of UseStateForUnknown()
plan modifiers be causing Pulumi to ignore changes in these fields?
4. Are there any known issues or limitations when using pulumi-terraform-bridge with providers built using terraform-plugin-framework?
5. How can I debug this further to understand why Pulumi isn't detecting the changes?
I'd greatly appreciate any insights, suggestions, or experiences with similar issues. If you need any additional information or clarification, please let me know.
Thank you in advance for your help!