Skip to content

Commit

Permalink
Merge pull request #63 from Infisical/daniel/fix-project-drift
Browse files Browse the repository at this point in the history
fix: project role drift when no conditions are set
  • Loading branch information
DanielHougaard authored Oct 9, 2024
2 parents 980fe51 + aca6fe9 commit 2a1a088
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions internal/provider/resource/project_role_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,21 @@ func (r *projectRoleResource) Read(ctx context.Context, req resource.ReadRequest
}
}

permissionPlan = append(permissionPlan, projectRoleResourcePermissions{
Action: types.StringValue(action),
Subject: types.StringValue(subject),
Conditions: &projectRoleResourcePermissionCondition{
var conditions *projectRoleResourcePermissionCondition

if el["conditions"] == nil {
conditions = nil
} else {
conditions = &projectRoleResourcePermissionCondition{
Environment: types.StringValue(environment),
SecretPath: types.StringValue(secretPath),
},
}
}

permissionPlan = append(permissionPlan, projectRoleResourcePermissions{
Action: types.StringValue(action),
Subject: types.StringValue(subject),
Conditions: conditions,
})
}

Expand Down

0 comments on commit 2a1a088

Please sign in to comment.