Let me state that I haven't studied CF specifically at all, I'm going from what I just read in Wikipedia and my general biology education.

It is caused by a defect in a specific cell channel that manages traffic of specific molecules into and out of the cell.

Per Wikipedia: "It is caused by the presence of mutations in both copies of the gene for the protein cystic fibrosis transmembrane conductance regulator (CFTR)."

Per the article on CFTR:

Cystic fibrosis transmembrane conductance regulator (CFTR) is a membrane protein and chloride channel in vertebrates that is encoded by the CFTR gene.

CFTR is an ABC transporter-class ion channel that codes for a protein that conducts chloride and thiocyanate ions across epithelial cell membranes.

More detail:

CFTR functions as an ATP-gated anion channel, increasing the conductance for certain anions (e.g. Cl−) to flow down their electrochemical gradient. ATP-driven conformational changes in CFTR open and close a gate to allow transmembrane flow of anions down their electrochemical gradient. This in contrast to other ABC proteins, in which ATP-driven conformational changes fuel uphill substrate transport across cellular membranes. Essentially, CFTR is an ion channel that evolved as a 'broken' ABC transporter that leaks when in open conformation.

The CFTR is found in the epithelial cells of many organs including the lung, liver, pancreas, digestive tract, reproductive tract, and skin. Normally, the protein moves chloride and thiocyanate ions (with a negative charge) out of an epithelial cell to the covering mucus. Positively charged sodium ions follow passively, increasing the total electrolyte concentration in the mucus, resulting in the movement of water out of cell by osmosis.

So, based on ATP getting to it, it allows movement (passive transport) of a set of ions and H2O in and out of cells. I assume there's some regulatory function that mediates the opening and closing of it; the CF mutations interfere with its function one way or another (e.g. one class is thought to result in the CFTR degrading quickly, don't know if it functions normally while in place).

So while we're mostly focused on the consequences of these ions and water not getting out of the cell and deranging the production of proper mucus, it could also result in metabolic derangement inside these cells. Per https://www.cff.org/Living-with-CF/Cystic-Fibrosis-Related-D... there's a Type 1 style due to direct pancreas damage interfering with production of insulin, but also a Type 2 style interfering with insulin response.

The latter is the sort of thing I'm getting at, I'd want to understand how it works before extrapolating from CF populations to the general one. As the article says, "Unlike people with type 1 or type 2 diabetes, people with CFRD need the same high-calorie CF diet they would normally eat in order to gain weight and build muscle. A healthy diet means eating a variety of foods that are high in protein, fat and salt. The only difference is that people with CFRD need to track or count the foods that affect their blood sugar levels the most." So your eating plenty of fat without apparent harm might or might not be significant for the general population and "normal" Type 2 Diabetes (and I don't know if there's only one form/cause of it).