thread ComputedBlocksAllowed through capabilities

pull/38305/head
James Bardin 4 weeks ago
parent 22598edbfe
commit 520378f9e6

@ -154,6 +154,7 @@ func (p *provider) ValidateResourceTypeConfig(_ context.Context, req *tfplugin5.
ClientCapabilities: providers.ClientCapabilities{
DeferralAllowed: true,
WriteOnlyAttributesAllowed: true,
ComputedBlocksAllowed: true,
},
})
@ -867,6 +868,7 @@ func (p *provider) PlanAction(_ context.Context, req *tfplugin5.PlanAction_Reque
ClientCapabilities: providers.ClientCapabilities{
DeferralAllowed: true,
WriteOnlyAttributesAllowed: true,
ComputedBlocksAllowed: true,
},
})
@ -899,6 +901,7 @@ func (p *provider) InvokeAction(req *tfplugin5.InvokeAction_Request, server tfpl
ClientCapabilities: providers.ClientCapabilities{
DeferralAllowed: true,
WriteOnlyAttributesAllowed: true,
ComputedBlocksAllowed: true,
},
})

@ -1196,6 +1196,7 @@ func (p *provider6) PlanAction(_ context.Context, req *tfplugin6.PlanAction_Requ
ClientCapabilities: providers.ClientCapabilities{
DeferralAllowed: true,
WriteOnlyAttributesAllowed: true,
ComputedBlocksAllowed: true,
},
})
@ -1228,6 +1229,7 @@ func (p *provider6) InvokeAction(req *tfplugin6.InvokeAction_Request, server tfp
ClientCapabilities: providers.ClientCapabilities{
DeferralAllowed: true,
WriteOnlyAttributesAllowed: true,
ComputedBlocksAllowed: true,
},
})

@ -108,6 +108,7 @@ func (n *NodeProviderConfigure) Execute(ctx *EvalContext) {
ClientCapabilities: providers.ClientCapabilities{
DeferralAllowed: ctx.deferralAllowed,
WriteOnlyAttributesAllowed: true,
ComputedBlocksAllowed: true,
},
})

@ -2073,6 +2073,7 @@ func clientCapabilitiesToProto(c providers.ClientCapabilities) *proto6.ClientCap
DeferralAllowed: c.DeferralAllowed,
WriteOnlyAttributesAllowed: c.WriteOnlyAttributesAllowed,
StorePlannedPrivate: c.StorePlannedPrivate,
ComputedBlocksAllowed: c.ComputedBlocksAllowed,
}
}

@ -312,6 +312,13 @@ type ClientCapabilities struct {
// returned from PlanResourceChange, and return it with the final
// PlanResourceChange call.
StorePlannedPrivate bool
// computed_blocks_allowed indicates that the client can handle optionally
// computed nested block values in resources. Because older versions of
// Terraform without this capability will ignore the computed flag in the
// schema, it is up to the provider to return an appropriate diagnostic when
// a resource requiring the computed behavior is used.
ComputedBlocksAllowed bool
}
type ValidateProviderConfigRequest struct {

@ -11,5 +11,6 @@ func ClientCapabilities() providers.ClientCapabilities {
return providers.ClientCapabilities{
DeferralAllowed: true,
WriteOnlyAttributesAllowed: true,
ComputedBlocksAllowed: true,
}
}

@ -1749,6 +1749,7 @@ func TestContext2Plan_blockNestingGroup(t *testing.T) {
DeferralAllowed: false,
WriteOnlyAttributesAllowed: true,
StorePlannedPrivate: true,
ComputedBlocksAllowed: true,
},
}
if !cmp.Equal(got, want, valueTrans) {

@ -229,12 +229,9 @@ func (ctx *BuiltinEvalContext) ConfigureProvider(addr addrs.AbsProviderConfig, c
}
req := providers.ConfigureProviderRequest{
TerraformVersion: version.String(),
Config: cfg,
ClientCapabilities: providers.ClientCapabilities{
DeferralAllowed: ctx.Deferrals().DeferralAllowed(),
WriteOnlyAttributesAllowed: true,
},
TerraformVersion: version.String(),
Config: cfg,
ClientCapabilities: ctx.ClientCapabilities(),
}
resp := p.ConfigureProvider(req)
@ -661,6 +658,7 @@ func (ctx *BuiltinEvalContext) ClientCapabilities() providers.ClientCapabilities
DeferralAllowed: ctx.Deferrals().DeferralAllowed(),
WriteOnlyAttributesAllowed: true,
StorePlannedPrivate: true,
ComputedBlocksAllowed: true,
}
}

@ -448,6 +448,8 @@ func (ctx *MockEvalContext) ClientCapabilities() providers.ClientCapabilities {
return providers.ClientCapabilities{
DeferralAllowed: ctx.Deferrals().DeferralAllowed(),
WriteOnlyAttributesAllowed: true,
StorePlannedPrivate: true,
ComputedBlocksAllowed: true,
}
}

Loading…
Cancel
Save