@@ -27,6 +27,7 @@ import (
2727 "github.com/pulumi/pulumi/sdk/v3/go/common/resource"
2828 "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin"
2929 "github.com/pulumi/pulumi/sdk/v3/go/common/tokens"
30+ "github.com/pulumi/pulumi/sdk/v3/go/property"
3031)
3132
3233// recordingPolicyEvents records all policy events for later inspection.
@@ -40,8 +41,8 @@ type recordingPolicyEvents struct {
4041
4142type remediationRecord struct {
4243 urn resource.URN
43- before resource. PropertyMap
44- after resource. PropertyMap
44+ before property. Map
45+ after property. Map
4546}
4647
4748func (r * recordingPolicyEvents ) OnPolicyViolation (urn resource.URN , d plugin.AnalyzeDiagnostic ) {
@@ -50,7 +51,7 @@ func (r *recordingPolicyEvents) OnPolicyViolation(urn resource.URN, d plugin.Ana
5051
5152func (r * recordingPolicyEvents ) OnPolicyRemediation (
5253 urn resource.URN , _ plugin.Remediation ,
53- before , after resource. PropertyMap ,
54+ before , after property. Map ,
5455) {
5556 r .remediations = append (r .remediations , remediationRecord {urn : urn , before : before , after : after })
5657}
@@ -212,11 +213,11 @@ func TestAnalyzeSnapshot_RemediationReportedNotApplied(t *testing.T) {
212213 t .Parallel ()
213214
214215 urn := resource .URN ("urn:pulumi:stack::project::pkg:index:MyResource::res" )
215- original := resource. PropertyMap {"key" : resource . NewProperty ("bad" )}
216- remediated := resource. PropertyMap {"key" : resource . NewProperty ("good" )}
216+ original := property . NewMap ( map [ string ]property. Value {"key" : property . New ("bad" )})
217+ remediated := property . NewMap ( map [ string ]property. Value {"key" : property . New ("good" )})
217218
218219 res := makeTestResource (urn )
219- res .Inputs = original
220+ res .Inputs = resource . ToResourcePropertyMap ( original )
220221
221222 snap := & deploy.Snapshot {Resources : []* resource.State {res }}
222223 events := & recordingPolicyEvents {}
@@ -229,13 +230,13 @@ func TestAnalyzeSnapshot_RemediationReportedNotApplied(t *testing.T) {
229230 PolicyName : "fix-key" ,
230231 PolicyPackName : "test-pack" ,
231232 Description : "sets key to good" ,
232- Properties : remediated ,
233+ Properties : resource . ToResourcePropertyMap ( remediated ) ,
233234 }},
234235 }, nil
235236 },
236237 // Analysis still sees the original properties (remediation was not applied).
237238 AnalyzeF : func (r plugin.AnalyzerResource ) (plugin.AnalyzeResponse , error ) {
238- assert .Equal (t , original , r .Properties ,
239+ assert .Equal (t , original , resource . FromResourcePropertyMap ( r .Properties ) ,
239240 "analysis should see original properties, not remediated ones" )
240241 return plugin.AnalyzeResponse {}, nil
241242 },
0 commit comments