Located on coast of Northland, on a sandy bank hidden by pampas, in shade but otherwise very sunny and dry. Leaves have lethal 'hooks' on them.
Here is a better photo showing the flower
HI Belinda NZPCN is about New Zealand native plants - this looks to be an exotic bromeliad of some sort. I'm not sure that bromeliads have become weedy in NZ as yet. If you would like further information about which species it is then please submit the photos to https://inaturalist.nz/
(JPG format, max 500kB)