In ArcGIS Pro, I added elevation sources for my basemap since I want to create a terrain map. However, the map is flat in ArcGIS Online after I shared the project as webscene. Is there anyway I can share a basemap with terrain to ArcGIS Online?
In ArcGIS Online you can host your own elevation layers.
In Pro you are going to use the Manage Tile Cache tool. Here you will use the elevation source data as the Data Source and on the Input Tiling Scheme, pick the option to use AGOL elevation tiling scheme or Import scheme with LERC tile format.Export Tile Cache tool to generate a tile package with the output from the Manage Tile Cache tool.
Upload that TPK to AGOL to create a hosted elevation layer and then you can add that hosted elevation layer back into Pro or you can add it into the scene viewer.
I wrote up a blog covering a workflow for creating elevation and scene layers for a local scene with fixed extent using Pro + AGOL: https://blogs.esri.com/esri/arcgis/2017/09/25/authoring-3d-layers-and-creating-web-scenes-in-arcgis-online/