Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ jobs:
needs: publish
# not a prerelease
if: ${{ !contains(github.ref_name,'-') }}
permissions:
id-token: write
contents: read
Comment on lines +43 to +45

@EronWright EronWright Nov 8, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An extra fix riding in this PR, this fix was applied directly to the v3.10.1 branch, will be needed going forward.

steps:
- name: Checkout Repo
uses: actions/checkout@v4
Expand Down
17 changes: 16 additions & 1 deletion provider/pkg/resources/customresources/custom_pim_eligibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,22 @@ func inputsToSdk(inputs resource.PropertyMap) (*armauthorization.RoleEligibility

if expiration, ok := info["expiration"]; ok {
exp := expiration.ObjectValue()
result.Properties.ScheduleInfo.Expiration.Duration = pulumi.StringRef(exp["duration"].StringValue())

// duration is optional - only present for AfterDuration type
if duration, ok := exp["duration"]; ok {
result.Properties.ScheduleInfo.Expiration.Duration = pulumi.StringRef(duration.StringValue())
}

// endDateTime is optional - only present for AfterDateTime type
if endDateTime, ok := exp["endDateTime"]; ok {
endTime, err := time.Parse(time.RFC3339, endDateTime.StringValue())
if err != nil {
return nil, fmt.Errorf("invalid end time: %w", err)
}
result.Properties.ScheduleInfo.Expiration.EndDateTime = &endTime
}

// type is required
expirationType := armauthorization.Type(exp["type"].StringValue())
result.Properties.ScheduleInfo.Expiration.Type = &expirationType
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,51 @@ func TestInputsToSdk(t *testing.T) {
assert.Equal(t, armauthorization.TypeAfterDuration, *sdk.Properties.ScheduleInfo.Expiration.Type)
})

t.Run("scheduleInfo with NoExpiration", func(t *testing.T) {
t.Parallel()

inputs := validRequiredInputs.Copy()
now := time.Now()
inputs["scheduleInfo"] = resource.NewObjectProperty(resource.PropertyMap{
"startDateTime": resource.NewStringProperty(now.Format(time.RFC3339)),
"expiration": resource.NewObjectProperty(resource.PropertyMap{
"type": resource.NewStringProperty("NoExpiration"),
}),
})

sdk, err := inputsToSdk(inputs)
require.NoError(t, err)
require.NotNil(t, sdk.Properties.ScheduleInfo)
assert.WithinDuration(t, now, *sdk.Properties.ScheduleInfo.StartDateTime, 1*time.Second)
assert.Nil(t, sdk.Properties.ScheduleInfo.Expiration.Duration)
assert.Nil(t, sdk.Properties.ScheduleInfo.Expiration.EndDateTime)
assert.Equal(t, armauthorization.TypeNoExpiration, *sdk.Properties.ScheduleInfo.Expiration.Type)
})

t.Run("scheduleInfo with AfterDateTime", func(t *testing.T) {
t.Parallel()

inputs := validRequiredInputs.Copy()
now := time.Now()
endTime := now.Add(24 * time.Hour)
inputs["scheduleInfo"] = resource.NewObjectProperty(resource.PropertyMap{
"startDateTime": resource.NewStringProperty(now.Format(time.RFC3339)),
"expiration": resource.NewObjectProperty(resource.PropertyMap{
"endDateTime": resource.NewStringProperty(endTime.Format(time.RFC3339)),
"type": resource.NewStringProperty("AfterDateTime"),
}),
})

sdk, err := inputsToSdk(inputs)
require.NoError(t, err)
require.NotNil(t, sdk.Properties.ScheduleInfo)
assert.WithinDuration(t, now, *sdk.Properties.ScheduleInfo.StartDateTime, 1*time.Second)
assert.Nil(t, sdk.Properties.ScheduleInfo.Expiration.Duration)
require.NotNil(t, sdk.Properties.ScheduleInfo.Expiration.EndDateTime)
assert.WithinDuration(t, endTime, *sdk.Properties.ScheduleInfo.Expiration.EndDateTime, 1*time.Second)
assert.Equal(t, armauthorization.TypeAfterDateTime, *sdk.Properties.ScheduleInfo.Expiration.Type)
})

t.Run("misc optional properties", func(t *testing.T) {
t.Parallel()

Expand Down
Loading