FillArrays has a OneElement type that provides a non-materialized implementation:
julia> OneElement(1 #= value =#, (2,2) #= index =#, (3,3) #= size =#)
3×3 OneElement{Int64, 2, Tuple{Int64, Int64}, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}}:
⋅ ⋅ ⋅
⋅ 1 ⋅
⋅ ⋅ ⋅
If you want a matrix from this, you may convert it:
julia> A = OneElement(1, (2,2), (3,3));
julia> Matrix(A)
3×3 Matrix{Int64}:
0 0 0
0 1 0
0 0 0